diff options
| author | Max Audron <audron@cocaine.farm> | 2025-02-27 01:03:29 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-02-27 01:03:29 +0100 |
| commit | e4338a9d9d0a76029bca376c2bcb499962575e87 (patch) | |
| tree | a0c14be508381e3f5091d1872210edd612f57dde /src/error.rs | |
| parent | implement NetworkId UserType (diff) | |
extend docs and reorganize files
Diffstat (limited to 'src/error.rs')
| -rw-r--r-- | src/error.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..7414062 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,45 @@ +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum ProtocolError { + #[error("message has wrong type")] + WrongMsgType, + #[error("bool value is neither 0 nor 1")] + BoolOutOfRange, + #[error("QVariant is not known")] + UnknownVariant, + #[error("UserType is not known: {0}")] + UnknownUserType(String), + #[error("wrong variant has been given")] + WrongVariant, + #[error("io error: {0}")] + IOError(#[from] std::io::Error), + #[error("could not convert from int: {0}")] + TryFromIntError(#[from] std::num::TryFromIntError), + #[error("utf8 error: {0}")] + Utf8Error(#[from] std::string::FromUtf8Error), + #[error("errored to parse char as utf16")] + CharError, + #[error("failed to deal with time: {0}")] + TimeError(#[from] time::error::ComponentRange), +} + +// impl std::error::Error for ErrorKind {} +// +// impl std::convert::From<std::io::Error> for ErrorKind { +// fn from(error: std::io::Error) -> Self { +// ErrorKind::IOError(error) +// } +// } +// +// impl std::convert::From<std::num::TryFromIntError> for ErrorKind { +// fn from(error: std::num::TryFromIntError) -> Self { +// ErrorKind::TryFromIntError(error) +// } +// } +// +// impl std::convert::From<std::string::FromUtf8Error> for ErrorKind { +// fn from(error: std::string::FromUtf8Error) -> Self { +// ErrorKind::Utf8Error(error) +// } +// } |
