diff options
Diffstat (limited to 'filamento/src/error.rs')
-rw-r--r-- | filamento/src/error.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/filamento/src/error.rs b/filamento/src/error.rs index 6277292..ccb4406 100644 --- a/filamento/src/error.rs +++ b/filamento/src/error.rs @@ -73,6 +73,8 @@ pub enum ConnectionJobError { pub enum RosterError { #[error("cache: {0}")] Cache(#[from] DatabaseError), + #[error("iq response: {0}")] + IqResponse(#[from] RequestError), #[error("stream write: {0}")] Write(#[from] WriteError), // TODO: display for stanza, to show as xml, same for read error types. @@ -87,6 +89,20 @@ pub enum RosterError { } #[derive(Debug, Error, Clone)] +pub enum RequestError { + #[error("sending request: {0}")] + Write(#[from] WriteError), + #[error("receiving expected response: {0}")] + Read(#[from] ReadError), +} + +#[derive(Debug, Error, Clone)] +pub enum ResponseError { + #[error("no matching id: {0}")] + NoMatchingId(String), +} + +#[derive(Debug, Error, Clone)] #[error("database error: {0}")] pub struct DatabaseError(pub Arc<sqlx::Error>); @@ -107,8 +123,8 @@ impl From<sqlx::Error> for DatabaseOpenError { pub enum IqError { #[error("writing response: {0}")] WriteError(#[from] WriteError), - #[error("no iq with id matching `{0}`")] - NoMatchingId(String), + #[error("receiving response: `{0}`")] + ReceivedResponse(#[from] ResponseError), #[error("incorrect addressee: {0}")] IncorrectAddressee(jid::JID), } |