summaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2025-07-12 13:46:33 +0200
committerrtkay123 <dev@kanjala.com>2025-07-12 13:46:33 +0200
commitba14505f39d8634921f260d715aa8e66f2a14406 (patch)
treee8d2cc267302d4036c42bb16b77029c6a6799f9d /src/error.rs
parent1dc7dccb7536f6831de570f535e6911384e1a7e4 (diff)
downloadsellershut-ba14505f39d8634921f260d715aa8e66f2a14406.tar.bz2
sellershut-ba14505f39d8634921f260d715aa8e66f2a14406.zip
feat: start server
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
new file mode 100644
index 0000000..730f99a
--- /dev/null
+++ b/src/error.rs
@@ -0,0 +1,26 @@
+use axum::{
+ http::StatusCode,
+ response::{IntoResponse, Response},
+};
+
+#[derive(Debug)]
+pub struct AppError(anyhow::Error);
+
+impl IntoResponse for AppError {
+ fn into_response(self) -> Response {
+ (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ format!("Something went wrong: {}", self.0),
+ )
+ .into_response()
+ }
+}
+
+impl<E> From<E> for AppError
+where
+ E: Into<anyhow::Error>,
+{
+ fn from(err: E) -> Self {
+ Self(err.into())
+ }
+}