Concerned about debuggability of test error messages

Hi,

I’m working my way through the Holochain Gym. I’m working on Basic - 5 - Elements, and I am concerned about how difficult it is to root cause errors from the tests. I’m not sure if this is something inherent to Rust, to the HDK, or just to the testing environment.

For example,

#[hdk_extern]
pub fn get_all_headers_from_content(input: SnackingLog) -> ExternResult<Vec<SignedHeaderHashed>> {
    let entry_hash = hash_entry(&input)?;
    let details = get_details(entry_hash, GetOptions::default())?
        // BUG
        .expect("The content was not found.");
    match details {
        Details::Entry(d) => return Ok(d.headers),
        // Our hash was calculated from an entry above, so get_details must return EntryDetails.
        _ => unreachable!()
    }
}

which is a bug, because one of the test cases tries to get the headers for content that was never added.

The test error output looked like the following. Significantly, the text The content was not found. does not appear. This is unfortunate, because that message would direct me to the buggy line. (Granted, the stack trace expect_failed helps, but if this were a method with multiple .expects, I would have to figure out which one was the problem.

...
ok 4 should be strictly equal
01:10:27 [tryorama] error: Test error: {
  type: 'error',
  data: {
    type: 'ribosome_error',
    data: 'Wasm error while working with Ribosome: CallError("RuntimeError: unreachable\\n    at __rust_start_panic (<module>[1842]:0x20546a)\\n    at rust_panic (<module>[1841]:0x20545e)\\n    at std::panicking::rust_panic_with_hook::h47a0e203360b6c10 (<module>[1834]:0x205123)\\n    at std::panicking::begin_panic_handler::{{closure}}::h888144d5e9a03cec (<module>[1823]:0x204a9d)\\n    at std::sys_common::backtrace::__rust_end_short_backtrace::h81961607fd97e28e (<module>[1822]:0x2049ec)\\n    at rust_begin_unwind (<module>[1833]:0x204ffc)\\n    at core::panicking::panic_fmt::h4ca53049f45e3264 (<module>[1919]:0x20b6d3)\\n    at core::panicking::panic_display::h5bb4c3c669911f66 (<module>[1928]:0x20be43)\\n    at core::option::expect_failed::hdf65ec749c93533c (<module>[1927]:0x20bdea)\\n    at elements::get_all_headers_from_content::h6bc1c3ffd3c1adfe (<module>[174]:0x1de3e)\\n    at get_all_headers_from_content (<module>[157]:0x1abb0)")'
  }
}
not ok 5 Test threw an exception. See output for details.
...

Another example. This lesson suggests modifying the tests to pass a HeaderHash to the get_by_entry_hash method because “it is interesting to see how it fails.” The test error looks like the following, which is a lot less helpful than something like “failed to deserialize value to EntryHash while calling get_by_entry_hash.” (I presume that is what the problem is.)

00:50:15 [tryorama] error: Test error: {
  type: 'error',
  data: {
    type: 'ribosome_error',
    data: 'Wasm error while working with Ribosome: Deserialize([217, 53, 117, 104, 67, 107, 107, 105, 87, 109, 114, 65, 70, 76, 72, 72, 112, 69, 82, 50, 56, 118, 79, 100, 117, 71, 117, 75, 103, 72, 54, 98, 85, 56, 76, 116, 65, 53, 65, 120, 120, 97, 52, 75, 119, 56, 65, 54, 111, 73, 81, 53, 53, 116, 122])'
  }
}

Why are these tryorama error messages so unhelpful? Is this something that could be improved in the HDK or tryorama? Thanks!