Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is the panic! log message ? #55

Open
Riduidel opened this issue Feb 19, 2019 · 4 comments
Open

Where is the panic! log message ? #55

Riduidel opened this issue Feb 19, 2019 · 4 comments
Milestone

Comments

@Riduidel
Copy link

🔦 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)

@samuela
Copy link

samuela commented Mar 18, 2019

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

@naturallymitchell
Copy link

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, jazzdotdev/jazz@8342368.

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.

@spacekookie spacekookie added this to the 2.0.0 milestone Jun 14, 2019
@Profpatsch
Copy link

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

human-panic/src/lib.rs

Lines 202 to 210 in 70db948

#[cfg(feature = "nightly")]
let cause = match panic_info.message() {
Some(m) => format!("{}", m),
None => "Unknown".into(),
};
#[cfg(not(feature = "nightly"))]
let cause =
String::from("Error cause could not be determined by the application.");

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?

@curiousleo
Copy link
Contributor

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 rust-lang/rust#66745.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants