human-panic icon indicating copy to clipboard operation
human-panic copied to clipboard

Where is the panic! log message ?

Open Riduidel opened this issue 6 years ago • 4 comments
trafficstars

🔦 question?

Expected Behavior

When using panic!, the log message is displayed prior to the stack trace. As an example, this statement

panic!("feed item {:?} can't be parsed, as it doesn't have pub_date", &self);

will display an error message in stdout prior to the stack trace.

Current Behavior

The generated log file contains lots of info, but not this log message

Possible Solution

How could I add the log message to that file ?

Context

I'm using human_panic in a command-line app I'm developing

Code Sample

Your Environment

name = 'rrss2imap' operating_system = 'windows' crate_version = '0.1.3-alpha.0'

(I'm quite sure this section could be automatically generated when using human_panic)

Riduidel avatar Feb 19 '19 19:02 Riduidel

Same here... I don't really understand how this was ignored, or if I'm severely misunderstanding something...

samuela avatar Mar 18 '19 07:03 samuela

In our project we reimplemented human-panic internally, so you could copy it in the meantime.

I'd really like some review of the code and to collaborate within this issue queue, since there still must be potential improvements available to this snippet, https://github.com/foundpatterns/torchbear/commit/83423689d2b9e39dbd0cdc841399e9d769f23f65.

I think what you're looking for would be in create_hook(), but it'd need to be added to the Error, in addition to the RUST_BACKTRACE.

naturallymitchell avatar Mar 18 '19 14:03 naturallymitchell

Huh, noticed this just now when the first error report from a user came in.

https://github.com/rust-cli/human-panic/blob/70db948973a746418e3a23434fe48fe45d3c9866/src/lib.rs#L202-L210

It’s kind of useless for us without the most important bit (the error message!)

The RFC has been closed since 2017, but the feature is still marked unstable rust only, which appears to be an oversight?

Profpatsch avatar Nov 12 '19 16:11 Profpatsch

The RFC has been closed since 2017, but the feature is still marked unstable rust only, which appears to be an oversight?

The tracking issue has just been corrected in this PR: https://github.com/rust-lang/rust/pull/66771/files#diff-23e04906de6f359a78328a93305eca79R95

The correct tracking issue for the stabilisation of PanicInfo::message is https://github.com/rust-lang/rust/issues/66745.

curiousleo avatar Dec 16 '19 16:12 curiousleo