Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

How to access fields of a Report #121

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

How to access fields of a Report #121

ghost opened this issue Dec 31, 2022 · 0 comments

Comments

@ghost
Copy link

ghost 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants