1use thiserror::Error;
2use web_sys::Element;
3
4pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(Debug, Error)]
7pub enum Error {
8 #[error("Window not found")]
9 WindowNotFound,
10
11 #[error("Document not found")]
12 DocumentNotFound,
13
14 #[error("Document root element not found")]
15 DocumentElementNotFound,
16
17 #[error("Body not found")]
18 BodyNotFound,
19
20 #[error("Location not found")]
21 LocationNotFound,
22
23 #[error("Specified selectors `{0}` is invalid")]
24 InvalidSelectors(String),
25
26 #[error("Could not found element by `{0}`")]
27 ElementNotFound(String),
28
29 #[error("Object is not an Element")]
30 IsNotAnElement,
31
32 #[error("Could not cast element {0:?}")]
33 ElementNotCast(Element),
34
35 #[error("Failed to setTimeout")]
36 FailedToSetTimeout,
37
38 #[error("Failed to request animation frame")]
39 FailedToRequestAnimationFrame,
40
41 #[error("Failed to wait for the next animation frame")]
42 FailedToWaitNextAnimationFrame,
43}