1pub type Result<T> = std::result::Result<T, Error>;
2
3#[derive(thiserror::Error, Debug)]
4pub enum Error {
5 #[error("Failed to load image {0}")]
6 LoadImage(String),
7 #[error("Bad GeoJSON: {0}")]
8 BadGeoJson(String),
9 #[error("The object is not compatible to {0}: {1}")]
10 BadEventFormat(&'static str, String),
11 #[error("Error: {0}")]
12 Unexpected(String),
13 #[error("JsError: {0}")]
15 JsError(String),
16}
17
18impl From<serde_wasm_bindgen::Error> for Error {
19 fn from(e: serde_wasm_bindgen::Error) -> Self {
20 Error::JsError(e.to_string())
21 }
22}