1use derive_more::{Display, From};
2
3pub type Result<T> = core::result::Result<T, Error>;
4
5#[derive(Debug, Display, From)]
6pub enum Error {
7	#[display("{_0}")]
8	#[from(String, &String, &str)]
9	Custom(String),
10
11	#[display("Selector '{selector}' is invalid.\nCause: {cause}")]
12	SelectorParse { selector: String, cause: String },
13}
14
15impl Error {
18	pub fn custom_from_err(err: impl std::error::Error) -> Self {
20		Self::Custom(err.to_string())
21	}
22
23	pub fn custom(val: impl Into<String>) -> Self {
25		Self::Custom(val.into())
26	}
27}
28
29impl std::error::Error for Error {}
34
35