Skip to content

Commit

Permalink
Fix human panic metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
joshka committed Aug 23, 2024
1 parent dde7165 commit b0a4418
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
14 changes: 4 additions & 10 deletions component-generated/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,11 @@ pub fn init() -> Result<()> {

#[cfg(not(debug_assertions))]
{
use human_panic::{handle_dump, print_msg, Metadata};
let meta = Metadata {
version: env!("CARGO_PKG_VERSION").into(),
name: env!("CARGO_PKG_NAME").into(),
authors: env!("CARGO_PKG_AUTHORS").replace(':', ", ").into(),
homepage: env!("CARGO_PKG_HOMEPAGE").into(),
};

let file_path = handle_dump(&meta, panic_info);
use human_panic::{handle_dump, metadata, print_msg};
let metadata = metadata!();
let file_path = handle_dump(&metadata, panic_info);
// prints human-panic message
print_msg(file_path, &meta)
print_msg(file_path, &metadata)
.expect("human-panic: printing error message to console failed");
eprintln!("{}", panic_hook.panic_report(panic_info)); // prints color-eyre stack trace to stderr
}
Expand Down
14 changes: 4 additions & 10 deletions component/template/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,11 @@ pub fn init() -> Result<()> {

#[cfg(not(debug_assertions))]
{
use human_panic::{handle_dump, print_msg, Metadata};
let meta = Metadata {
version: env!("CARGO_PKG_VERSION").into(),
name: env!("CARGO_PKG_NAME").into(),
authors: env!("CARGO_PKG_AUTHORS").replace(':', ", ").into(),
homepage: env!("CARGO_PKG_HOMEPAGE").into(),
};

let file_path = handle_dump(&meta, panic_info);
use human_panic::{handle_dump, metadata, print_msg};
let metadata = metadata!();
let file_path = handle_dump(&metadata, panic_info);
// prints human-panic message
print_msg(file_path, &meta)
print_msg(file_path, &metadata)
.expect("human-panic: printing error message to console failed");
eprintln!("{}", panic_hook.panic_report(panic_info)); // prints color-eyre stack trace to stderr
}
Expand Down

0 comments on commit b0a4418

Please sign in to comment.