mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +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",
|
"router_env",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
"serde_path_to_error",
|
||||||
"serde_qs",
|
"serde_qs",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"sha2",
|
"sha2",
|
||||||
@ -2894,6 +2895,15 @@ dependencies = [
|
|||||||
"serde",
|
"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]]
|
[[package]]
|
||||||
name = "serde_qs"
|
name = "serde_qs"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
|
|||||||
@ -53,6 +53,7 @@ reqwest = { version = "0.11.12", features = ["json"] }
|
|||||||
ring = "0.16.20"
|
ring = "0.16.20"
|
||||||
serde = { version = "1.0.145", features = ["derive"] }
|
serde = { version = "1.0.145", features = ["derive"] }
|
||||||
serde_json = "1.0.85"
|
serde_json = "1.0.85"
|
||||||
|
serde_path_to_error = "0.1.8"
|
||||||
serde_qs = { version = "0.10.1", optional = true }
|
serde_qs = { version = "0.10.1", optional = true }
|
||||||
serde_urlencoded = "0.7.1"
|
serde_urlencoded = "0.7.1"
|
||||||
sha2 = "0.10.5"
|
sha2 = "0.10.5"
|
||||||
|
|||||||
@ -165,10 +165,10 @@ impl Settings {
|
|||||||
)
|
)
|
||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
config.try_deserialize().map_err(|e| {
|
serde_path_to_error::deserialize(config).map_err(|error| {
|
||||||
logger::error!("Unable to source config file");
|
logger::error!(%error, "Unable to deserialize application configuration");
|
||||||
eprintln!("Unable to source config file");
|
eprintln!("Unable to deserialize application configuration: {error}");
|
||||||
BachError::from(e)
|
BachError::from(error.into_inner())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,7 +119,7 @@ pub enum BachError {
|
|||||||
#[error("{{ error_description: Error while parsing, error_message: {0} }}")]
|
#[error("{{ error_description: Error while parsing, error_message: {0} }}")]
|
||||||
EParsingError(error_stack::Report<ParsingError>),
|
EParsingError(error_stack::Report<ParsingError>),
|
||||||
|
|
||||||
#[error("Environment configuration error: {0}")]
|
#[error("Application configuration error: {0}")]
|
||||||
ConfigurationError(ConfigError),
|
ConfigurationError(ConfigError),
|
||||||
|
|
||||||
#[error("{{ error_description: Database operation failed, error_message: {0} }}")]
|
#[error("{{ error_description: Database operation failed, error_message: {0} }}")]
|
||||||
|
|||||||
Reference in New Issue
Block a user