Files
fluid/backend-rust/step2-database-only/src/errors.rs
folex fc3b9bad73 WIP
2019-08-16 17:24:28 +03:00

19 lines
363 B
Rust

use std::fmt;
#[derive(Debug)]
pub struct Error(String);
impl std::error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0)
}
}
pub fn err_msg(s: &str) -> Box<Error> {
Error(s.to_string()).into()
}
pub type AppResult<T> = ::std::result::Result<T, Box<Error>>;