Files
featherChat/warzone/crates/warzone-server/src/errors.rs
Siavash Sameni 94b845eb5b Fix all compiler warnings across server and client
- Remove unused ServerConfig struct (config via CLI args)
- Remove unused otpks field from Database (not yet needed)
- Wire AppError into message routes with proper error propagation
- Remove unused imports in send.rs (Seed, MessageContent, etc.)
- Suppress dead_code on BundleResponse.fingerprint (needed by serde)

Zero warnings, 17/17 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:16:11 +04:00

22 lines
590 B
Rust

use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
/// Wraps anyhow::Error into an axum-compatible error response.
pub struct AppError(pub anyhow::Error);
impl IntoResponse for AppError {
fn into_response(self) -> Response {
tracing::error!("{:#}", self.0);
(StatusCode::INTERNAL_SERVER_ERROR, self.0.to_string()).into_response()
}
}
impl<E: Into<anyhow::Error>> From<E> for AppError {
fn from(err: E) -> Self {
AppError(err.into())
}
}
/// Convenience type for route handlers.
pub type AppResult<T> = Result<T, AppError>;