Support error chain description with opening indent level#36
Open
jubishop wants to merge 2 commits intoFlineDev:mainfrom
Open
Support error chain description with opening indent level#36jubishop wants to merge 2 commits intoFlineDev:mainfrom
jubishop wants to merge 2 commits intoFlineDev:mainfrom
Conversation
Contributor
Author
|
I'm going to formulate some more on how to solve this but I still think this change should stand. Users may want to start their error chain printout at an indented level in logs. |
Contributor
Author
|
hey so I kind of came up with my own solution to errorChainDescription, which I will paste below. this means this change is no longer important to me, although I would still lean towards giving users the flexibility to print their error chain with any initial indent depth. here's the code I've come up with and some tests that hopefully indicate how it's used and works. it just uses userFriendlyMessage all the way down.. |
Contributor
Author
|
I've also gone ahead and marked the catch await closure as @sendable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed Changes
Sometimes I still want to wrap an error manually, and provide additional messaging on both the wrapper level and the leaf level. the problem with simple
catch/caughtis only the bottom leaf level prints any details. here's a simplified example use case:by being able to pass my indent I can get this formatted nicely, an example end result printout when I print an
errorChainDescriptionof a.fetchFailureis:id be more than happy to entertain alternative on how to achieve something like this. this approach still only allows theoretical details to come out the top and the bottom of an error chain, everything in between would still be erased, but this is at least an improvement, and exposing the indent variable with a default of "" doesn't seem like its harming much.
a larger change would be to provide a way to print a more verbose error chain that does something like checking at every depth level to see if the Error is Throwable including the userFriendlyMessage when it exists, or to also include the
String(describingat every level.