Move 17 library crates into crates/, CLI binary into bin/fxt, consolidate 10 test crates into testing/, split config crate from deployment config files. Root directory reduced from 38+ to ~17 directories. All Cargo.toml paths and build.rs proto refs updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
88 lines
3.1 KiB
Rust
88 lines
3.1 KiB
Rust
//! Error types for TLI
|
|
|
|
use thiserror::Error;
|
|
|
|
/// Comprehensive error type for TLI operations
|
|
///
|
|
/// Represents all possible errors that can occur in the TLI client system,
|
|
/// including network connectivity, configuration, validation, and protocol errors.
|
|
#[derive(Error, Debug)]
|
|
pub enum TliError {
|
|
/// Network connection or gRPC transport errors
|
|
///
|
|
/// Occurs when unable to establish or maintain connections to trading services,
|
|
/// including network timeouts, DNS resolution failures, and connection drops.
|
|
#[error("Connection error: {0}")]
|
|
Connection(String),
|
|
|
|
/// Configuration loading or validation errors
|
|
///
|
|
/// Occurs when configuration files are malformed, missing required fields,
|
|
/// or contain invalid values that prevent proper system initialization.
|
|
#[error("Configuration error: {0}")]
|
|
Config(String),
|
|
|
|
/// Dashboard rendering or UI component errors
|
|
///
|
|
/// Occurs when terminal UI components fail to render, update, or handle
|
|
/// user input properly in the TLI dashboard interface.
|
|
#[error("Dashboard error: {0}")]
|
|
Dashboard(String),
|
|
|
|
/// File system or general I/O operation errors
|
|
///
|
|
/// Covers file read/write failures, permission errors, and other
|
|
/// input/output operations that fail at the system level.
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
/// gRPC protocol or service communication errors
|
|
///
|
|
/// Represents errors from gRPC calls including service unavailable,
|
|
/// authentication failures, timeout errors, and malformed responses.
|
|
#[error("gRPC error: {0}")]
|
|
Grpc(#[from] tonic::Status),
|
|
|
|
/// Invalid request parameters or data validation errors
|
|
///
|
|
/// Occurs when client requests contain invalid data such as negative
|
|
/// quantities, malformed orders, or parameters that fail validation.
|
|
#[error("Invalid request: {0}")]
|
|
InvalidRequest(String),
|
|
|
|
/// Resource not found errors
|
|
///
|
|
/// Occurs when requested resources such as orders, positions, or
|
|
/// configurations cannot be located in the system.
|
|
#[error("Not found: {0}")]
|
|
NotFound(String),
|
|
|
|
/// Buffer overflow or capacity limit errors
|
|
///
|
|
/// Occurs when internal buffers for events, metrics, or data streams
|
|
/// reach capacity limits and cannot accept additional data.
|
|
#[error("Buffer full: {0}")]
|
|
BufferFull(String),
|
|
|
|
/// Trading symbol validation errors
|
|
///
|
|
/// Occurs when trading symbols fail format validation, contain invalid
|
|
/// characters, or exceed length limits for the trading system.
|
|
#[error("Invalid symbol: {0}")]
|
|
InvalidSymbol(String),
|
|
|
|
/// Catch-all for unexpected or unclassified errors
|
|
///
|
|
/// Used for errors that don't fit into other categories or represent
|
|
/// unexpected system states that require investigation.
|
|
#[error("Other error: {0}")]
|
|
Other(String),
|
|
}
|
|
|
|
/// Result type alias for TLI operations
|
|
///
|
|
/// Standard Result type using `TliError` as the error variant.
|
|
///
|
|
/// Used throughout the TLI codebase for consistent error handling.
|
|
pub type TliResult<T> = Result<T, TliError>;
|