create error module for services

This commit is contained in:
ghassmo
2021-05-14 17:46:46 +03:00
parent 5139164d71
commit 182cf36bbc

20
src/service/error.rs Normal file
View File

@@ -0,0 +1,20 @@
use std::fmt;
pub type Result<T> = std::result::Result<T, ServicesError>;
#[derive(Debug, Copy, Clone)]
pub enum ServicesError {
ResonseError(&'static str),
}
impl std::error::Error for ServicesError {}
impl fmt::Display for ServicesError {
fn fmt(&self, f: &mut fmt::Formatter) -> std::fmt::Result {
match *self {
ServicesError::ResonseError(ref err) => write!(f, "Response: {}", err),
}
}
}