zola/components/errors/src/lib.rs
Vincent Prouillet b7ce4e59fb rustfmt
2018-10-31 08:18:57 +01:00

35 lines
640 B
Rust
Executable file

#![allow(unused_doc_comments)]
#[macro_use]
extern crate error_chain;
extern crate image;
extern crate syntect;
extern crate tera;
extern crate toml;
error_chain! {
errors {}
links {
Tera(tera::Error, tera::ErrorKind);
}
foreign_links {
Io(::std::io::Error);
Toml(toml::de::Error);
Image(image::ImageError);
Syntect(syntect::LoadingError);
}
}
// So we can use bail! in all other crates
#[macro_export]
macro_rules! bail {
($e:expr) => {
return Err($e.into());
};
($fmt:expr, $($arg:tt)+) => {
return Err(format!($fmt, $($arg)+).into());
};
}