-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Exception Summaries #8
Conversation
Filter the stacktrace _before_ processing it all, which can improve perf quite a bit. Before: ```julia julia> try @Assert false catch @time summarize_current_exceptions() end === EXCEPTION SUMMARY === AssertionError: false [1] top-level scope @ ./REPL[95]:2 0.004641 seconds (484 allocations: 27.102 KiB) ``` After: ```julia julia> try @Assert false catch @time summarize_current_exceptions() end === EXCEPTION SUMMARY === AssertionError: false [1] top-level scope @ ./REPL[95]:2 0.001720 seconds (228 allocations: 12.766 KiB) ```
- Number the items in a CompositeException when printing. - Support multiline exception strings, still indented properly on each of their multiple lines. - Add a test for these situations. For example: ```julia === EXCEPTION SUMMARY === CompositeException (length 2): 1. MultiLineException( 0 ) [1] throw_multiline(x::Int64) @ Main foo.jl:23 which caused: MultiLineException( 1 ) [1] throw_multiline(x::Int64) @ Main foo.jl:23 2. MultiLineException( 2 ) [1] throw_multiline(x::Int64) @ Main foo.jl:23 which caused: MultiLineException( 3 ) [1] throw_multiline(x::Int64) @ Main foo.jl:23 ```
This hopefully makes it clearer what's going on, for a reader who doesn't already know what a CompositeException is for.
now that the items are numbered
@msagarpatel:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msagarpatel: I think this PR LGTM!
I'll leave it open in case there's anything else you want to address, but this looks really great. :)
I made a few more improvements today, and I think this is ready to use! We should plug it in to RAICode, since it's not helping anyone just sitting here. 😊 We can always make more changes later, but i think this would already be really, really helpful.
Co-authored-by: Nathan Daly <NHDaly@gmail.com>
Thanks @NHDaly! I'm still going through your comments and changes. Gonna check out for the night, but I'm aiming to wrap this up tomorrow. |
This PR adds the ability to summarize the current exception. This is especially helpful in cases where there are large exceptions with multiple TaskFailedExceptions and CompositeExceptions wrapping multiple exceptions.
The interface is simple:
Examples:
TODOs