onecodex/needletail

Error on files with whitespace for FASTX records is unclear

Closed this issue · 0 comments

bovee commented

If you try to parse a file that with a header and a couple newlines (e.g. >test\n\n\n), the error message is a little cryptic:

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 18446744073709551615', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/slice.rs:640
note: Run with `RUST_BACKTRACE=1` for a backtrace.

This looks like it's happening during whitespace stripping (presumably because the record left behind is blank?):

   9:        0x... - core::panicking::panic_bounds_check::...
  10:        0x... - needletail::fastx::strip_whitespace::...
  11:        0x... - needletail::fastx::fasta_record::...

We should probably be catching these somehow and returning something more helpful.