Expand description
Easy error handling types for the Matrix API
Contains the trait MatrixApiError, and a couple of error types that are
shared across a lot of endpoints. Every error that can be returned to the
user should implement MatrixApiError, and
[axum::response::IntoResponse], preferably through the derive macro
MatrixApiError
The point of MatrixApiError, in contrast to other error types in Arminius, is to handle errors from which no recovery is possible. This can happen either because it’s a “this should never happen bug”, like an invalid database state, or because the error is due to user input.
From this it follows that the only job of a MatrixApiError is to return
information to the user, and not to provide diagnostics. Diagnostics should,
if needed, be emitted in the From<T> trait for the relevant error type,
because that is the point at which we give up on handling the error, and
begin propagating it.
Structs§
- BadJson
- Error when user JSON is missing fields
- Event
NotFound - Feature
NotImplemented - A feature that has not been implemented.
- Forbidden
- Internal
Server Error - Represents an unrecoverable error
- NotJson
- Error for when user sends us invalid JSON
- Room
NotFound - Unauthorized
Enums§
- Input
Json Error - Error type that may occur when working with user-provided JSON.
Traits§
- Matrix
ApiError - Trait for errors that can be converted into matrix errors
- Result
Ext - Extension trait for
Resultthat allows us to handle unrecoverable errors
Functions§
- create_
custom_ matrix_ error - Create a custom matrix error
- create_
matrix_ error - Create a matrix error
Derive Macros§
- Matrix
ApiError - Re-export the MatrixApiError derive macro here, so one just needs to depend
on arminius-lib-component when implementing MatrixApiErrors.
Implements the traits
arminius_lib_component::error::MatrixApiErrorand [axum::response::IntoResponse] for the struct or enum. Errors can be defined on structs or on enums