-
-
Notifications
You must be signed in to change notification settings - Fork 2
Support error chain description with opening indent level #36
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
base: main
Are you sure you want to change the base?
Conversation
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. |
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..
|
I've also gone ahead and marked the catch await closure as @sendable |
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/caught
is 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
errorChainDescription
of a.fetchFailure
is: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(describing
at every level.