26 lines
860 B
Rust
26 lines
860 B
Rust
use thiserror::Error;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum AppError {
|
|
#[error("An IO error occurred")]
|
|
Io(#[from] std::io::Error),
|
|
#[error("A TryGetError occurred")]
|
|
TryGet(#[from] bytes::TryGetError),
|
|
#[error("The buffer is missing data")]
|
|
IncompleteBuffer,
|
|
#[error("A Utf8Error occurred")]
|
|
FromUtf8(#[from] std::string::FromUtf8Error),
|
|
#[error("The command {0} was not recognized")]
|
|
UnknownCommand(String),
|
|
#[error("The specified key's length {0} exceeds the limit")]
|
|
KeyLength(usize),
|
|
#[error("Received no response")]
|
|
NoResponse,
|
|
#[error("Expected a different response for the executed command")]
|
|
InvalidCommandResponse,
|
|
#[error("The binary data is not structured correctly")]
|
|
UnexpectedData,
|
|
#[error("Failed to convert integer")]
|
|
TryFromInt(#[from] std::num::TryFromIntError),
|
|
}
|