webmetro/src/error.rs

19 lines
640 B
Rust
Raw Permalink Normal View History

2018-04-13 23:01:40 +00:00
use custom_error::custom_error;
2018-04-13 23:01:40 +00:00
custom_error!{pub WebmetroError
ResourcesExceeded = "resources exceeded",
2019-10-16 03:36:23 +00:00
EbmlError{source: crate::ebml::EbmlError} = "EBML error: {source}",
HttpError{source: http::Error} = "HTTP error: {source}",
HyperError{source: hyper::Error} = "Hyper error: {source}",
IoError{source: std::io::Error} = "IO error: {source}",
WarpError{source: warp::Error} = "Warp error: {source}",
ApplicationError{message: String} = "{message}"
2018-04-13 23:01:40 +00:00
}
impl From<&str> for WebmetroError {
fn from(message: &str) -> WebmetroError {
WebmetroError::ApplicationError{message: message.into()}
}
}