v0.14.0
This commit is contained in:
@@ -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");
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user