feat: enhance error handling in OAuth URL building and client creation; improve tool argument sanitization
This commit is contained in:
+13
-4
@@ -60,10 +60,19 @@ impl AppConfig {
|
||||
pub fn load() -> Self {
|
||||
let store = super::store::Store::new();
|
||||
let path = store.base_dir.join("app_config.json");
|
||||
let mut cfg: AppConfig = std::fs::read_to_string(path)
|
||||
.ok()
|
||||
.and_then(|s| serde_json::from_str(&s).ok())
|
||||
.unwrap_or_default();
|
||||
let mut cfg: AppConfig = match std::fs::read_to_string(&path) {
|
||||
Ok(s) => match serde_json::from_str(&s) {
|
||||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
eprintln!(
|
||||
"warning: failed to parse config file '{}': {}. Loading defaults.",
|
||||
path.display(), e
|
||||
);
|
||||
Self::default()
|
||||
}
|
||||
},
|
||||
Err(_) => Self::default(),
|
||||
};
|
||||
// Merge any default providers not present in the loaded config
|
||||
let defaults = Self::default();
|
||||
for (name, provider) in defaults.providers {
|
||||
|
||||
Reference in New Issue
Block a user