- Fixed systematic array indexing corruption: [0_i32] → [0] - Fixed numeric literal suffixes across 835 files - Fixed iterator patterns on RwLockReadGuard (.iter() required) - Fixed float type annotations (365.25_f64 for sqrt) - Fixed missing semicolons in position manager - Fixed reference dereferencing in data loader Root cause: Mass refactoring incorrectly added _i32 suffixes to array indices Impact: Complete compilation failure (463 errors) Resolution: Automated regex + targeted fixes Result: 100% compilation success (0 errors) Validated: cargo check --workspace passes Ready for: Production deployment
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>;
|