Handling 'nested errors' in TypeScript
What's a good method for dealing with "nested errors"? Right now I do this:
I use these to get typed errors from non effect apis, ex:
The problem with this is that when I log an error via
A reason I do it this way is so I can get good traces in Sentry. It will recursively read
Is there a better pattern for dealing with "nested errors" like this? I could manually unpack everything in my logger but I wanted to check if I missed a better way to handle the nesting of errors that naturally occurs when capturing non-effect errors as tagged effect failures.
I use these to get typed errors from non effect apis, ex:
The problem with this is that when I log an error via
Cause.pretty the underlying error with the useful information (in the cause field of the failure) doesn't get printed.A reason I do it this way is so I can get good traces in Sentry. It will recursively read
Error.cause which is a convention supported by browsersIs there a better pattern for dealing with "nested errors" like this? I could manually unpack everything in my logger but I wanted to check if I missed a better way to handle the nesting of errors that naturally occurs when capturing non-effect errors as tagged effect failures.
