commit ee0630ef97fbdb420e046c67853e7581048b389e
parent 54df83be67cd35880ed62541dace5b4ae3568ac8
Author: Silas Brack <silasbrack@gmail.com>
Date: Fri, 12 Jun 2026 22:18:29 +0200
chore: remove thiserror, hand-impl Display + Error
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -1482,7 +1482,6 @@ dependencies = [
"rand 0.8.6",
"rusqlite",
"serde",
- "thiserror",
"tokio",
"tokio-stream",
"tracing",
diff --git a/Cargo.toml b/Cargo.toml
@@ -11,7 +11,6 @@ chrono = { version = "0.4", features = ["serde"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "net"] }
serde = { version = "1", features = ["derive"] }
tokio-stream = { version = "0.1", features = ["sync"] }
-thiserror = "2"
tracing = "0.1"
rusqlite = "0.31"
r2d2 = "0.8"
diff --git a/src/error.rs b/src/error.rs
@@ -1,20 +1,31 @@
use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
-use thiserror::Error;
-#[derive(Error, Debug)]
+#[derive(Debug)]
pub enum AppError {
- #[error("Database error: {0}")]
Database(String),
+ Template(askama::Error),
+ NotFound(String),
+ Unauthorized(String),
+}
- #[error("Template error: {0}")]
- Template(#[from] askama::Error),
+impl std::fmt::Display for AppError {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ Self::Database(e) => write!(f, "Database error: {e}"),
+ Self::Template(e) => write!(f, "Template error: {e}"),
+ Self::NotFound(e) => write!(f, "Not found: {e}"),
+ Self::Unauthorized(e) => write!(f, "Unauthorized: {e}"),
+ }
+ }
+}
- #[error("Not found: {0}")]
- NotFound(String),
+impl std::error::Error for AppError {}
- #[error("Unauthorized: {0}")]
- Unauthorized(String),
+impl From<askama::Error> for AppError {
+ fn from(e: askama::Error) -> Self {
+ Self::Template(e)
+ }
}
impl IntoResponse for AppError {