1mod error;
2mod span;
3
4pub use error::*;
5pub use span::*;
6
7pub type Result<T, E = Error> = std::result::Result<T, E>;
8
9#[macro_export]
10macro_rules! bail {
11 ($span:expr, $msg:expr) => {
12 return Err($crate::Error::str("error reported here").wrap_str($crate::Spanned::as_ref(&$span).map(|_| format!($msg))));
13 };
14
15 ($span:expr, $fmt:expr, $($arg:tt)*) => {
16 return Err($crate::Error::str("error reported here").wrap_str($crate::Spanned::as_ref(&$span).map(|_| format!($fmt, $($arg)*))));
17 };
18}
19
20#[macro_export]
21macro_rules! bail_here {
22 ($msg:expr) => {
23 return Err($crate::Error::str(format!($msg)));
24 };
25
26 ($fmt:expr, $($arg:tt)*) => {
27 return Err($crate::Error::str(format!($fmt, $($arg)*)));
28 };
29}