mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(settings): log path to field where config deserialization failed (#78)
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -2650,6 +2650,7 @@ dependencies = [
|
||||
"router_env",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_path_to_error",
|
||||
"serde_qs",
|
||||
"serde_urlencoded",
|
||||
"sha2",
|
||||
@ -2894,6 +2895,15 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_path_to_error"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "184c643044780f7ceb59104cef98a5a6f12cb2288a7bc701ab93a362b49fd47d"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_qs"
|
||||
version = "0.10.1"
|
||||
|
||||
@ -53,6 +53,7 @@ reqwest = { version = "0.11.12", features = ["json"] }
|
||||
ring = "0.16.20"
|
||||
serde = { version = "1.0.145", features = ["derive"] }
|
||||
serde_json = "1.0.85"
|
||||
serde_path_to_error = "0.1.8"
|
||||
serde_qs = { version = "0.10.1", optional = true }
|
||||
serde_urlencoded = "0.7.1"
|
||||
sha2 = "0.10.5"
|
||||
|
||||
@ -165,10 +165,10 @@ impl Settings {
|
||||
)
|
||||
.build()?;
|
||||
|
||||
config.try_deserialize().map_err(|e| {
|
||||
logger::error!("Unable to source config file");
|
||||
eprintln!("Unable to source config file");
|
||||
BachError::from(e)
|
||||
serde_path_to_error::deserialize(config).map_err(|error| {
|
||||
logger::error!(%error, "Unable to deserialize application configuration");
|
||||
eprintln!("Unable to deserialize application configuration: {error}");
|
||||
BachError::from(error.into_inner())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ pub enum BachError {
|
||||
#[error("{{ error_description: Error while parsing, error_message: {0} }}")]
|
||||
EParsingError(error_stack::Report<ParsingError>),
|
||||
|
||||
#[error("Environment configuration error: {0}")]
|
||||
#[error("Application configuration error: {0}")]
|
||||
ConfigurationError(ConfigError),
|
||||
|
||||
#[error("{{ error_description: Database operation failed, error_message: {0} }}")]
|
||||
|
||||
Reference in New Issue
Block a user