Skip to content

Commit

Permalink
Downcast panic payload to String too in example.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Jun 11, 2024
1 parent c4dea81 commit 518722e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions std/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ impl<'a> PanicHookInfo<'a> {
/// panic::set_hook(Box::new(|panic_info| {
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
/// println!("panic occurred: {s:?}");
/// } else if let Some(s) = panic_info.payload().downcast_ref::<String>() {
/// println!("panic occurred: {s:?}");
/// } else {
/// println!("panic occurred");
/// }
Expand Down

0 comments on commit 518722e

Please sign in to comment.