issue-4099 Introduce the ability to show root-cause first in exception stacktraces on error pages #4904
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The commit here adds an enhancement that was requested in #4099.
What this change does is, it "reverses" the stacktrace of the exception that is being displayed on the Quarkus error page. Once reversed, the root cause of the exception will show up first and then its "successor" and so on.
For example, imagine this "original" exception stacktrace:
Once reversed, this stacktrace will now up as:
Our error pages will show the reversed (root-cause first) exception stacktraces by default. There's a visible/prominent message which states:
The "Click Here" link when clicked will show the exception stacktrace in the original format.
I decided to keep this (Javascript based) toggle to let users decide which representation they prefer.
The only thing that I kind of dislike is that I had to introduce the requirement of having javascript enabled (to provide this toggling). I tend to avoid allowing javascripts by default on random pages, but I guess for something like this use case, this is OK?
If anyone is interested to visualize this feature, I think for now, you can download this html file https://gist.github.com/jaikiran/fcc0798708e13e0144be7082493db06d and just open it locally in a browser and see how it looks. That was generated from a Quarkus application, which had this change and which threw an error while serving a REST endpoint