diff options
author | rtkay123 <dev@kanjala.com> | 2025-07-23 13:39:40 +0200 |
---|---|---|
committer | rtkay123 <dev@kanjala.com> | 2025-07-23 13:39:40 +0200 |
commit | 089efa225cc0a4e7be12608129ddbff28d11f320 (patch) | |
tree | d5d27ba5f5056c7a539365fd314e6d7ce7529523 /crates/auth/src/error.rs | |
parent | 0a48abb0f0d4752b639fb89dd2db32a3db0eebb8 (diff) | |
download | sellershut-089efa225cc0a4e7be12608129ddbff28d11f320.tar.bz2 sellershut-089efa225cc0a4e7be12608129ddbff28d11f320.zip |
feat(auth): discord oauth
Diffstat (limited to 'crates/auth/src/error.rs')
-rw-r--r-- | crates/auth/src/error.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/auth/src/error.rs b/crates/auth/src/error.rs new file mode 100644 index 0000000..730f99a --- /dev/null +++ b/crates/auth/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()) + } +} |