feat: enhance error handling in OAuth URL building and client creation; improve tool argument sanitization

This commit is contained in:
asepharyana
2026-07-12 10:23:26 +07:00
parent 0cc60c12ce
commit bb621fdff2
10 changed files with 79 additions and 43 deletions
+13 -4
View File
@@ -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 {