Uncaught panic inside the library?
yory8 opened this issue · 1 comments
yory8 commented
Confy 0.3.1
Steps:
- remove the closing single quote from a value in your toml file, so that it becomes invalid
key: 'value
otherkey: 'value'
- run your program, which uses this code:
let cfg: Config = match confy::load("appname") {
Ok(_) => {
println!("Done!");
std::process::exit(exitcode::OK);
}
Err(e) => {
eprintln!("Error: {}", e);
std::process::exit(exitcode::CONFIG);
}
}
Expected:
The program exits cleanly with exitcode::CONFIG error code, after printing Error: etc
.
Actual Result:
`thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { inner: ErrorInner { kind: NewlineInString, line: Some(0), col: 14, message: "", key: [] } }', libcore/result.rs:1009:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::continue_panic_fmt
6: rust_begin_unwind
7: core::panicking::panic_fmt
8: core::result::unwrap_failed
9: confy::load
10: ren::main
11: std::rt::lang_start::{{closure}}
12: std::panicking::try::do_call
13: __rust_maybe_catch_panic
14: std::rt::lang_start_internal
15: main
16: __libc_start_main
17: _start
Dylan-DPC-zz commented
This is fixed by #12