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

How to access fields of a Report #121

Open
Ararem opened this issue Dec 31, 2022 · 0 comments
Open

How to access fields of a Report #121

Ararem opened this issue Dec 31, 2022 · 0 comments

Comments

@Ararem
Copy link

Ararem commented Dec 31, 2022

I'm trying to display Reports in an app of mine (using ImGUI), and I'm having trouble accessing the data hidden inside the Report. For example, I'd like to access the backtrace and spantrace (preferably as raw structs not strings), and then do things to make them appear in the UI.

I can't access these on the Report object because it doesn't provide access to any.

One solution is to downcast to a concrete type:

report
    .handler()
    .downcast_ref::<color_eyre::Handler>()
    .map(|h| h.spantrace())

This only lets me access the SpanTrace and BackTrace though, but not the location (file) or any Sections. I think I might be able to get the location form the BackTrace, but I'm not sure since I haven't used that crate directly before. Also, downcasting like this isn't good, because what if the handler isn't the default eyre handler but something else, then my code completely breaks.

Any help would be much appreciated (especially if I'm barking up the wrong tree and looking in the wrong spot)

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