This commit is contained in:
Mateusz Gruszczyński
2026-09-14 16:32:28 +02:00
parent c3fbc5ccc6
commit 021cbddba5
68 changed files with 7780 additions and 202 deletions
+5
View File
@@ -18,6 +18,8 @@ pub enum AppError {
Unauthorized,
#[error("device communication failed: {0}")]
Device(String),
#[error("external dependency failed: {0}")]
Dependency(String),
#[error(transparent)]
Internal(#[from] anyhow::Error),
}
@@ -30,6 +32,9 @@ impl IntoResponse for AppError {
Self::Conflict(v) => (StatusCode::CONFLICT, v.clone()),
Self::Unauthorized => (StatusCode::UNAUTHORIZED, "unauthorized".into()),
Self::Device(v) => (StatusCode::BAD_GATEWAY, v.clone()),
// Cloud/provider outages are an expected external-dependency failure, not a
// controller-side 502. Keep Local's historical Device -> 502 mapping unchanged.
Self::Dependency(v) => (StatusCode::FAILED_DEPENDENCY, v.clone()),
Self::Internal(v) => {
tracing::error!(error = ?v, "internal error");
(