diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-09 22:52:42 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-09 23:49:40 -0400 |
| commit | e55565cb3841bf17cf7b8a5e5cf84e59e4372e11 (patch) | |
| tree | 31fdbf7d8fbd6b1783c599347642592e4b44ea13 /src/error.rs | |
| parent | 66c99389e4725d96ef68298a9c608654b9517d4b (diff) | |
Normalize `not found` errors a bit.
Diffstat (limited to 'src/error.rs')
| -rw-r--r-- | src/error.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index 8792a1d..85573d4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -69,3 +69,15 @@ impl IntoResponse for Unauthorized { (StatusCode::UNAUTHORIZED, "unauthorized").into_response() } } + +pub struct NotFound<E>(pub E); + +impl<E> IntoResponse for NotFound<E> +where + E: std::error::Error, +{ + fn into_response(self) -> Response { + let Self(response) = self; + (StatusCode::NOT_FOUND, response.to_string()).into_response() + } +} |
