wasm_css/
error.rs

1// Authors: Robert Lopez
2
3/// Represents any `Error` as a human readable error String
4///
5/// The only way Errors can occur in this crate are not having access to the:
6/// Head, Crypto, Window, or Document objects.
7#[derive(Debug)]
8pub struct WasmCssError(pub String);
9
10impl std::fmt::Display for WasmCssError {
11    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
12        writeln!(f, "WasmCssError: {}", self.0)
13    }
14}
15
16impl std::error::Error for WasmCssError {}
17
18macro_rules! format_error {
19    ($fmt:expr $(, $arg:expr)*) => {
20        $crate::error::WasmCssError(format!($fmt $(, $arg)*))
21    };
22}
23
24pub(crate) use format_error;