1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error(transparent)]
    YamlError(#[from] serde_yaml::Error),

    #[error("Unsupported yaml type: {0:?}")]
    UnsupportedType(serde_yaml::Value),

    #[error("Cannot get colorized string without feature `color` enabled")]
    ColorizeWithoutFeature,
}

#[cfg(target_family = "wasm")]
impl From<Error> for wasm_bindgen::prelude::JsValue {
    fn from(value: Error) -> wasm_bindgen::prelude::JsValue {
        wasm_bindgen::prelude::JsValue::from_str(&value.to_string())
    }
}