1use core::fmt::Debug;
5
6#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
8#[non_exhaustive]
9pub enum Error {
10 #[error("invalid fragment")]
11 InvalidFragment,
12 #[error("invalid method id")]
13 InvalidMethodId,
14 #[error("invalid method name")]
15 InvalidMethodName,
16 #[error("invalid path")]
17 InvalidPath,
18 #[error("invalid query")]
19 InvalidQuery,
20 #[error("invalid scheme")]
21 InvalidScheme,
22 #[error("{0}")]
23 Other(&'static str),
24}
25
26impl From<did_url_parser::Error> for Error {
27 fn from(error: did_url_parser::Error) -> Self {
28 match error {
29 did_url_parser::Error::InvalidFragment => Self::InvalidFragment,
30 did_url_parser::Error::InvalidMethodId => Self::InvalidMethodId,
31 did_url_parser::Error::InvalidMethodName => Self::InvalidMethodName,
32 did_url_parser::Error::InvalidPath => Self::InvalidPath,
33 did_url_parser::Error::InvalidQuery => Self::InvalidQuery,
34 did_url_parser::Error::InvalidScheme => Self::InvalidScheme,
35 error => Self::Other(error.as_str()),
36 }
37 }
38}