Skip to content

Commit

Permalink
panichookinfo instead of panichook
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy committed Oct 18, 2024
1 parent b6845f2 commit acf51d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions aderyn/src/panic.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(clippy::unwrap_used)]
use std::{io::Write, panic::PanicInfo};
use std::{io::Write, panic::PanicHookInfo};
use termcolor::{Color, ColorSpec, WriteColor};

use std::io::IsTerminal;
Expand All @@ -24,10 +24,12 @@ pub fn stderr_buffer_writer() -> BufferWriter {
}

pub fn add_handler() {
std::panic::set_hook(Box::new(move |info: &PanicInfo<'_>| print_compiler_bug_message(info)));
std::panic::set_hook(Box::new(move |info: &PanicHookInfo<'_>| {
print_compiler_bug_message(info)
}));
}

fn print_compiler_bug_message(info: &PanicInfo<'_>) {
fn print_compiler_bug_message(info: &PanicHookInfo<'_>) {
let message =
match (info.payload().downcast_ref::<&str>(), info.payload().downcast_ref::<String>()) {
(Some(s), _) => (*s).to_string(),
Expand Down

0 comments on commit acf51d5

Please sign in to comment.