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

Cause (Payload) Does Not Support Strings #58

Open
frankwillis42 opened this issue Jun 18, 2019 · 0 comments
Open

Cause (Payload) Does Not Support Strings #58

frankwillis42 opened this issue Jun 18, 2019 · 0 comments

Comments

@frankwillis42
Copy link

let payload = panic_info.payload().downcast_ref::<&str>();

The code attempts to downcast to &str but this will return None if the PanicInfo.payload() is a String. For example, consider the following panic:

panic!("this is a {}", "test");

The "Cause" will not be displayed in the "explanation" portion of the dump file as this panic has a payload of type String which is not &str. How do I get the Cause to show when I use a panic such as this? Or does this require a code change to support downcasting to other types such as String?

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

1 participant