mirror of https://github.com/Trivernis/bromine.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
634 B
Rust
34 lines
634 B
Rust
4 years ago
|
use thiserror::Error;
|
||
|
|
||
|
pub type Result<T> = std::result::Result<T, Error>;
|
||
|
|
||
|
#[derive(Error, Debug)]
|
||
|
pub enum Error {
|
||
|
#[error(transparent)]
|
||
|
IoError(#[from] tokio::io::Error),
|
||
|
|
||
|
#[error(transparent)]
|
||
|
Decode(#[from] rmp_serde::decode::Error),
|
||
|
|
||
|
#[error(transparent)]
|
||
|
Encode(#[from] rmp_serde::encode::Error),
|
||
|
|
||
|
#[error("Build Error: {0}")]
|
||
|
BuildError(String),
|
||
|
|
||
|
#[error("{0}")]
|
||
|
Message(String),
|
||
|
}
|
||
|
|
||
|
impl From<String> for Error {
|
||
|
fn from(s: String) -> Self {
|
||
|
Error::Message(s)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl From<&str> for Error {
|
||
|
fn from(s: &str) -> Self {
|
||
|
Error::Message(s.to_string())
|
||
|
}
|
||
|
}
|