Skip to content

Commit e047223

Browse files
committed
Merge remote-tracking branch 'fork/psql' into testing
2 parents bb120e1 + 7e8b427 commit e047223

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pkgs.mkShell {
55
rustc
66
cargo
77
cargo-audit
8+
clippy
89
rustfmt
910
rust-analyzer
1011
git

src/main.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extern crate rocket;
22

33
use chrono::{self, NaiveDateTime, Timelike};
44
use chrono::{DateTime, Datelike, FixedOffset};
5-
use clap::{Parser, crate_authors};
5+
use clap::{CommandFactory, Parser};
66
use config_file::FromConfigFile;
77
use core::str;
88
use log::{debug, error, info, trace, warn};
@@ -237,7 +237,7 @@ async fn upload(
237237
ocsp::common::ocsp::OcspExt::Nonce { nonce } => Some(nonce.len()),
238238
_ => None,
239239
})
240-
.last()
240+
.next_back()
241241
}) {
242242
Some(1..128) | None => (),
243243
_ => {
@@ -476,17 +476,25 @@ fn rocket() -> rocket::Rocket<rocket::Build> {
476476
let config_path = &cli.config_path;
477477

478478
if !Path::new(config_path).exists() {
479-
panic!("Config file not found at: {}", config_path.display());
479+
eprintln!("Error: Config file not found at: {}", config_path);
480+
eprintln!("\nUsage information:");
481+
let mut cli_command = Cli::command();
482+
if let Err(err) = cli_command.print_help() {
483+
eprintln!("Could not display help: {}", err);
484+
}
485+
std::process::exit(1);
480486
}
481487

482488
let config = match Fileconfig::from_config_file(config_path) {
483489
Ok(config) => config,
484490
Err(e) => {
485-
panic!(
486-
"Error reading config file at {}: {}",
487-
config_path.display(),
488-
e
489-
);
491+
eprintln!("Error: Reading config file at {}: {}", config_path, e);
492+
eprintln!("\nUsage information:");
493+
let mut cli_command = Cli::command();
494+
if let Err(err) = cli_command.print_help() {
495+
eprintln!("Could not display help: {}", err);
496+
}
497+
std::process::exit(1);
490498
}
491499
};
492500
let cert_raw = match File::open(&config.itcert) {
@@ -562,6 +570,7 @@ fn rocket() -> rocket::Rocket<rocket::Build> {
562570
.clone()
563571
.unwrap_or_else(|| DEFAULT_LISTEN_IP.to_string());
564572

573+
565574
// Determine database type and default port
566575
let db_type = config
567576
.db_type

0 commit comments

Comments
 (0)