diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-26 17:50:54 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-26 17:58:27 +0100 |
commit | dfb5714045e99a09bf3f67890ae3cdeab47058b3 (patch) | |
tree | 5e76e310892ea7e36099312e25023aa154217a28 /pkgs/by-name/ba/back/src/error/responder.rs | |
parent | fix(pkgs/back): Use rocket to manage the configuration values (diff) | |
download | nixos-server-dfb5714045e99a09bf3f67890ae3cdeab47058b3.tar.gz nixos-server-dfb5714045e99a09bf3f67890ae3cdeab47058b3.zip |
feat(pkgs/back): Rewrite the `git-bug` interface code
The previous code was more or less reverse engineered, whilst this code is based on the actually git-bug source code. This improves the whole issue and operation handling immensely and also makes the code better maintainable. Furthermore, it also adds support for the operations that had not already used in `vhack.eu/nixos-server.git`.
Diffstat (limited to 'pkgs/by-name/ba/back/src/error/responder.rs')
-rw-r--r-- | pkgs/by-name/ba/back/src/error/responder.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/by-name/ba/back/src/error/responder.rs b/pkgs/by-name/ba/back/src/error/responder.rs new file mode 100644 index 0000000..7bea961 --- /dev/null +++ b/pkgs/by-name/ba/back/src/error/responder.rs @@ -0,0 +1,23 @@ +// Back - An extremely simple git issue tracking system. Inspired by tvix's +// panettone +// +// Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This file is part of Back. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/agpl.txt>. + +use rocket::{ + response::{self, Responder, Response}, + Request, +}; + +use super::Error; + +impl<'r> Responder<'r, 'static> for Error { + fn respond_to(self, req: &'r Request<'_>) -> response::Result<'static> { + Response::build_from(self.to_string().respond_to(req)?).ok() + } +} |