mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
Better error message on failing to parse --verify-fn
clap formats the FromStr::Err's arising from parsing the flags with the Display formatter. This is a very reasonable default but it also means it loses all the context, since anyhow::Error only prints the outermost error in Display. So any failure parsing/creating/loading the function is displayed to the user as simple "compiling and loading rust function", which is impossible to debug. Using the Debug formatting in impl FromStr for RustFunction helps work around this.
This commit is contained in:
parent
a787b0023d
commit
1d46b44fcf
1 changed files with 2 additions and 1 deletions
|
|
@ -25,7 +25,8 @@ impl FromStr for RustFunction {
|
|||
type Err = anyhow::Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Self::compile(s).context("compiling and loading rust function")
|
||||
Self::compile(s)
|
||||
.map_err(|e| anyhow::format_err!("compiling and loading rust function: {:?}", e))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue