diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-26 18:22:54 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-26 18:22:54 +0100 |
commit | 94d5eeca2f9b3892aea8e0e91c863a031e6bc157 (patch) | |
tree | 8aa638d338c84d2b5e33900b20c08b86d008718b /pkgs/by-name/ba/back/src | |
parent | chore(pkgs/back): Add missing license headers (diff) | |
download | nixos-server-94d5eeca2f9b3892aea8e0e91c863a031e6bc157.tar.gz nixos-server-94d5eeca2f9b3892aea8e0e91c863a031e6bc157.zip |
fix(pkgs/back): Use the errors display trait not debug
Sadly, there seems to be no other way to change the error display, than wrapping main.
Diffstat (limited to 'pkgs/by-name/ba/back/src')
-rw-r--r-- | pkgs/by-name/ba/back/src/main.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/by-name/ba/back/src/main.rs b/pkgs/by-name/ba/back/src/main.rs index 009bdb6..b75737a 100644 --- a/pkgs/by-name/ba/back/src/main.rs +++ b/pkgs/by-name/ba/back/src/main.rs @@ -9,6 +9,8 @@ // You should have received a copy of the License along with this program. // If not, see <https://www.gnu.org/licenses/agpl.txt>. +use std::process; + use clap::Parser; use config::BackConfig; use rocket::routes; @@ -21,8 +23,17 @@ mod error; pub mod git_bug; mod web; +fn main() -> Result<(), String> { + if let Err(err) = rocket_main() { + eprintln!("Error {err}"); + process::exit(1); + } else { + Ok(()) + } +} + #[rocket::main] -async fn main() -> Result<(), error::Error> { +async fn rocket_main() -> Result<(), error::Error> { let args = cli::Cli::parse(); let config = BackConfig::from_config_file(&args.config_file)?; |