pub enum PriceLevelError {
ParseError {
message: String,
},
InvalidFormat,
UnknownOrderType(String),
MissingField(String),
InvalidFieldValue {
field: String,
value: String,
},
InvalidOperation {
message: String,
},
SerializationError {
message: String,
},
DeserializationError {
message: String,
},
ChecksumMismatch {
expected: String,
actual: String,
},
}Expand description
Represents errors that can occur when processing price levels in trading operations.
This enum encapsulates various error conditions that might arise during order book management, price validation, and other trading-related operations.
§Examples
use pricelevel::PriceLevelError;
// Creating a parse error
let error = PriceLevelError::ParseError {
message: "Failed to parse price: invalid decimal format".to_string()
};
// Creating a missing field error
let missing_field_error = PriceLevelError::MissingField("price".to_string());Variants§
ParseError
Error that occurs when parsing fails with a specific message.
This variant is used when string conversion or data parsing operations fail.
InvalidFormat
Error indicating that the input is in an invalid format.
This is a general error for when the input data doesn’t conform to expected patterns but doesn’t fit into more specific error categories.
UnknownOrderType(String)
Error indicating an unrecognized order type was provided.
Used when the system encounters an order type string that isn’t in the supported set. The string parameter contains the unrecognized order type.
MissingField(String)
Error indicating a required field is missing.
Used when a mandatory field is absent in the input data. The string parameter specifies which field is missing.
InvalidFieldValue
Error indicating a field has an invalid value.
This error occurs when a field’s value is present but doesn’t meet validation criteria.
Fields
InvalidOperation
Error indicating an operation cannot be performed for the specified reason.
Used when an action is prevented due to business rules or system constraints.
SerializationError
Error raised when serialization of internal data structures fails.
DeserializationError
Error raised when deserialization of external data into internal structures fails.
ChecksumMismatch
Error raised when a checksum validation fails while restoring a snapshot.