implement Error for jid crate error types
This commit is contained in:
parent
20fc4b1966
commit
3c412ea6b0
|
@ -62,11 +62,23 @@ impl sqlx::Encode<'_, Sqlite> for JID {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum JIDError {
|
||||
NoResourcePart,
|
||||
ParseError(ParseError),
|
||||
}
|
||||
|
||||
impl Display for JIDError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
JIDError::NoResourcePart => f.write_str("resourcepart missing"),
|
||||
JIDError::ParseError(parse_error) => parse_error.fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for JIDError {}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ParseError {
|
||||
Empty,
|
||||
|
|
Loading…
Reference in New Issue