icepick: better error handling

This commit is contained in:
Ryan Heywood 2025-01-22 04:10:48 -05:00
parent d00a67e0b7
commit a473f74417
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
2 changed files with 6 additions and 3 deletions

View File

@ -122,7 +122,10 @@ pub fn do_cli_thing() {
});
let config_path = config_file.unwrap_or_else(|| "icepick.toml".to_string());
let config_content = std::fs::read_to_string(config_path).expect("can't read config file");
let mut config: Config = toml::from_str(&config_content).expect("config file had invalid toml");
let mut config: Config = match toml::from_str(&config_content) {
Ok(config) => config,
Err(e) => panic!("Error while loading TOML config: {e}"),
};
config.modules.push(ModuleConfig {
name: "internal".to_string(),
command_name: Default::default(),

View File

@ -87,7 +87,7 @@ impl InvocableOperation {
let result = child.wait_with_output().unwrap();
if !result.status.success() {
panic!("Bad exit: {}", String::from_utf8_lossy(&result.stderr));
panic!("Bad exit ({}: {}): {}", &self.binary, &self.operation.name, String::from_utf8_lossy(&result.stderr));
}
let output = result.stdout;
@ -133,7 +133,7 @@ impl Workflow {
}
}
}
panic!("Key was not found: {input}");
panic!("Required workflow input was not found: {input}");
}
map