zola/components/errors/src/lib.rs

35 lines
640 B
Rust
Raw Normal View History

2018-06-25 17:13:21 +00:00
#![allow(unused_doc_comments)]
2017-07-01 07:47:41 +00:00
#[macro_use]
extern crate error_chain;
2018-02-02 20:35:04 +00:00
extern crate image;
2018-10-09 12:33:43 +00:00
extern crate syntect;
2018-10-31 07:18:57 +00:00
extern crate tera;
extern crate toml;
2017-07-01 07:47:41 +00:00
error_chain! {
errors {}
links {
Tera(tera::Error, tera::ErrorKind);
}
foreign_links {
Io(::std::io::Error);
Toml(toml::de::Error);
2018-02-02 20:35:04 +00:00
Image(image::ImageError);
2018-10-09 12:33:43 +00:00
Syntect(syntect::LoadingError);
2017-07-01 07:47:41 +00:00
}
}
// 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());
};
}