Do not fall if token path is wrong
@@ -38,8 +38,11 @@ impl TokenHandlerConfig {
let token_list_name = self.token_list_file();
let path = format!("etc/token-lists/{}.json", token_list_name);
- serde_json::from_str(&fs::read_to_string(path).expect("Invalid config path"))
- .expect("Invalid config format")
+ if let Ok(data) = &fs::read_to_string(path) {
+ serde_json::from_str(data).expect("Invalid config format")
+ } else {
+ vec![]
+ }
}
}
