1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

Simplify error handling in user-facing routes

This commit is contained in:
Quentin Gliech
2022-05-10 16:51:12 +02:00
parent 2cba5e7ad2
commit ca7b26cf18
17 changed files with 192 additions and 383 deletions

View File

@@ -32,6 +32,7 @@ use mas_storage::{
};
use serde::{de::DeserializeOwned, Deserialize};
use sqlx::{Acquire, Postgres};
use thiserror::Error;
#[derive(Debug, Deserialize)]
struct AuthorizedForm<F> {
@@ -111,10 +112,18 @@ pub enum UserAuthorizationError {
InternalError(Box<dyn Error>),
}
#[derive(Debug, Error)]
pub enum AuthorizationVerificationError {
#[error("missing token")]
MissingToken,
#[error("invalid token")]
InvalidToken,
#[error("missing form")]
MissingForm,
#[error(transparent)]
InternalError(Box<dyn Error>),
}