Skip to content

Commit e66745e

Browse files
authored
zenohd-default config error #1292 (#1298)
* Zenohd panic when tring load file When zenohd trying load file, if it have a problem it crash cause another treat was "unwrap", and it return to a type config. So, it crash and cause painic. * zenohd default config error #1292 When tring load config file defined by -c option. With haver any problema "unwrap" has been to Config type. I treat it return a Default Config whe it happen * If file fail when try load configs If file fail when try load configs * Update main.rs * Resolve typos at comment Resolve typos at comment
1 parent fef38dc commit e66745e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

zenohd/src/main.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ fn config_from_args(args: &Args) -> Config {
123123
.config
124124
.as_ref()
125125
.map_or_else(Config::default, |conf_file| {
126-
Config::from_file(conf_file).unwrap()
126+
Config::from_file(conf_file).unwrap_or_else(|e| {
127+
// if file load fail, wanning it, and load default config
128+
tracing::warn!("Warn: File {} not found! {}", conf_file, e.to_string());
129+
Config::default()
130+
})
127131
});
128132

129133
if config.mode().is_none() {

0 commit comments

Comments
 (0)