liquid_ml/error.rs
1//! The possible error types when using the liquid-ml crate.
2use thiserror::Error;
3
4/// An enumeration of `LiquidML` errors.
5#[derive(Debug, Error)]
6pub enum LiquidError {
7 /// Attempted to access a row in a `DataFrame` that is out of bounds
8 #[error("Row index out of bounds")]
9 RowIndexOutOfBounds,
10 /// Attempted to access a column in a `DataFrame` that is out of bounds
11 #[error("Column index out of bounds")]
12 ColIndexOutOfBounds,
13 /// Attempted to add or re-name a `Column` in a `DataFrame` to a name that
14 /// is already in use in that `DataFrame`
15 #[error("Name already in use")]
16 NameAlreadyExists,
17 /// Attempted to perform an operation that conflicts with a `DataFrame`s
18 /// schema, e.g. attempting to use `set_int` for a column that is of type
19 /// `String`
20 #[error("The requested operation doesn't match the schema data type")]
21 TypeMismatch,
22 /// A generic error when there is an underlying error with a `TCP`
23 /// connection
24 #[error("Network error")]
25 NetworkError(#[from] std::io::Error),
26 /// An error when serializing or deserializing
27 #[error("Serialization/Deserialization Error")]
28 SerdeError(#[from] Box<bincode::ErrorKind>),
29 /// An error when trying to send messages to nodes that are not currently
30 /// connected to this node
31 #[error("Who you sending this to?")]
32 UnknownId,
33 /// An error when multiple connections are made to the same `id`
34 #[error("Trying to connect at an Id that already exists")]
35 ReconnectionError,
36 /// An error when trying to `get` a value from a `KVStore` that does not
37 /// exist at that `KVStore`
38 #[error("Key is not present at this node")]
39 NotPresent,
40 /// An error when a connection is closed unexpectedly
41 #[error("Unexpected Stream shutdown")]
42 StreamClosed,
43 /// An error when messages are received unexpectedly, e.g. when a `Client`
44 /// is starting up and messages other than `ControlMsg`s are received
45 #[error("Unexpected Message")]
46 UnexpectedMessage,
47}