Deno: print backtrace on panic

Created on 23 Oct 2018  路  4Comments  路  Source: denoland/deno

Currently a panic looks like this:

> ./out/debug/deno tests/http_bench.ts
PANIC file 'libcore/option.rs' line 989
Abort trap: 6

This because we've had to override the default panic handler because Tokio (sadly / mistakenly) swallows panics.

It would be very nice to not have to open LLDB to get a backtrace. I expect this issue can be done in one or two lines of code.

Most helpful comment

Aside simplification is to eprint panic_info.to_string():

  std::panic::set_hook(Box::new(|panic_info| {
    eprintln!("{}", panic_info.to_string());
    std::process::abort();
  }));

All 4 comments

std::rt seems have unstable API for getting backtraces. There is a crate backtrace that serves as a wrapper for this which aims to be more stable.

@ry I see is just two lines of code but what's the complexity of this task? you haven't assigned a label.
I would love to work on it.

@Kachulio1 go for it - please see the comments in #1076 first.

Aside simplification is to eprint panic_info.to_string():

  std::panic::set_hook(Box::new(|panic_info| {
    eprintln!("{}", panic_info.to_string());
    std::process::abort();
  }));
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ry picture ry  路  3Comments

davidbarratt picture davidbarratt  路  3Comments

motss picture motss  路  3Comments

JosephAkayesi picture JosephAkayesi  路  3Comments

metakeule picture metakeule  路  3Comments