diff options
| author | 2025-02-25 18:52:14 +0000 | |
|---|---|---|
| committer | 2025-02-25 18:52:14 +0000 | |
| commit | 3c412ea6b05fbc0c399cf95e1658bfd50492e722 (patch) | |
| tree | 5cb3d6dd9bba05b405e9d7fb315c2a731fdae5db /jid/src | |
| parent | 20fc4b196670c7f218abe87eba0fec43ed5068a6 (diff) | |
| download | luz-3c412ea6b05fbc0c399cf95e1658bfd50492e722.tar.gz luz-3c412ea6b05fbc0c399cf95e1658bfd50492e722.tar.bz2 luz-3c412ea6b05fbc0c399cf95e1658bfd50492e722.zip | |
implement Error for jid crate error types
Diffstat (limited to '')
| -rw-r--r-- | jid/src/lib.rs | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/jid/src/lib.rs b/jid/src/lib.rs index 52b7173..09b0a7f 100644 --- a/jid/src/lib.rs +++ b/jid/src/lib.rs @@ -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, | 
