refactor Error::bad_config

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-12 07:41:01 +00:00
parent 93ec4e579b
commit 4cc92dd175
10 changed files with 71 additions and 66 deletions

View file

@ -24,7 +24,7 @@ use url::Url;
pub use self::check::check;
use self::proxy::ProxyConfig;
use crate::error::Error;
use crate::{error::Error, Err};
pub mod check;
pub mod proxy;
@ -433,13 +433,13 @@ impl Config {
};
let config = match raw_config.extract::<Self>() {
Err(e) => return Err(Error::BadConfig(format!("{e}"))),
Err(e) => return Err!("There was a problem with your configuration file: {e}"),
Ok(config) => config,
};
// don't start if we're listening on both UNIX sockets and TCP at same time
if Self::is_dual_listening(&raw_config) {
return Err(Error::bad_config("dual listening on UNIX and TCP sockets not allowed."));
return Err!(Config("address", "dual listening on UNIX and TCP sockets not allowed."));
};
Ok(config)