You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ RUST_BACKTRACE=1 cargo run install hoge
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/frum install hoge`
thread 'main' panicked at 'internal error: entered unreachable code', src/version.rs:33:13
stack backtrace:
0: rust_begin_unwind
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14
2: core::panicking::panic
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:50:5
3: frum::version::Version::parse
at ./src/version.rs:33:13
4: <frum::input_version::InputVersion as core::str::traits::FromStr>::from_str
at ./src/input_version.rs:47:15
5: frum::main::{{closure}}
at ./src/main.rs:58:21
6: core::option::Option<T>::map
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/option.rs:823:29
7: frum::main
at ./src/main.rs:57:26
8: core::ops::function::FnOnce::call_once
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
I found at least two not-good points of error handling of this repository.
I think the following error is not user-friendly.
I found at least two not-good points of error handling of this repository.
Version.parse()
panics. This should return an error if the parse failed.expect()
. Here, we should receive errors and show them to users.I recommend you to use eyre and color-eyre. See https://github.com/yaahc/color-eyre/blob/master/examples/usage.rs and try to run.
(eyre is a fork of anyhow and I think eyre suits CLI programs because it has additional features like suggestion.)
The text was updated successfully, but these errors were encountered: