bspeice/dtparse

panicked at 'called `Result::unwrap()` on an `Err` value: Error { message: "Invalid decimal: unknown character" }'

Closed this issue · 1 comments

Input
66:'

Output

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { message: "Invalid decimal: unknown character" }', /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1290:34
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: core::result::Result<T,E>::unwrap
             at /home/xsh/code/rust-compiler/src/libcore/result.rs:1005
  10: dtparse::Parser::to_decimal
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1290
  11: dtparse::Parser::parse_numeric_token
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1105
  12: dtparse::Parser::parse_with_tokens
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:771
  13: dtparse::Parser::parse
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:719
  14: dtparse::parse
             at /home/xsh/.cargo/registry/src/github.com-1ecc6299db9ec823/dtparse-1.2.0/src/lib.rs:1346

Expect
return error properly instead of panic

I'm able to recreate this one, looking into it now.