This commit is contained in:
Mateusz Gruszczyński
2026-08-27 22:58:13 +02:00
parent b93a1f2d92
commit 6572ff368b
19 changed files with 398 additions and 51 deletions
+3
View File
@@ -8,6 +8,8 @@ pub enum AppError {
NotFound(String),
#[error("invalid request: {0}")]
BadRequest(String),
#[error("conflict: {0}")]
Conflict(String),
#[error("unauthorized")]
Unauthorized,
#[error("device communication failed: {0}")]
@@ -21,6 +23,7 @@ impl IntoResponse for AppError {
let (status, message) = match &self {
Self::NotFound(v) => (StatusCode::NOT_FOUND, v.clone()),
Self::BadRequest(v) => (StatusCode::BAD_REQUEST, v.clone()),
Self::Conflict(v) => (StatusCode::CONFLICT, v.clone()),
Self::Unauthorized => (StatusCode::UNAUTHORIZED, "unauthorized".into()),
Self::Device(v) => (StatusCode::BAD_GATEWAY, v.clone()),
Self::Internal(v) => {