icepick: better error handling
This commit is contained in:
parent
d00a67e0b7
commit
a473f74417
|
@ -122,7 +122,10 @@ pub fn do_cli_thing() {
|
||||||
});
|
});
|
||||||
let config_path = config_file.unwrap_or_else(|| "icepick.toml".to_string());
|
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 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 {
|
config.modules.push(ModuleConfig {
|
||||||
name: "internal".to_string(),
|
name: "internal".to_string(),
|
||||||
command_name: Default::default(),
|
command_name: Default::default(),
|
||||||
|
|
|
@ -87,7 +87,7 @@ impl InvocableOperation {
|
||||||
|
|
||||||
let result = child.wait_with_output().unwrap();
|
let result = child.wait_with_output().unwrap();
|
||||||
if !result.status.success() {
|
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;
|
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
|
map
|
||||||
|
|
Loading…
Reference in New Issue