-
Notifications
You must be signed in to change notification settings - Fork 28
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
Improve Show instance of Effectful.Error.Static.ErrorWrapper #232
Conversation
e9f5c5e
to
491271a
Compare
11c1d57
to
e0b02ea
Compare
For example, if a third-party library spawns worker threads and if a job throws, it simply catches SomeException, logs it and retries the job later, as of today internal exceptions representing errors of the `Error` effect wouldn't show any info about the error, just the backtrace. This fixes it at the cost of small API breakage.
e0b02ea
to
a022b49
Compare
@arybczak Is there a way to avoid catching ErrorWrapper in such a scenario? There doesn't seen to be a predicate similar to isSyncException, and the type isn't exported for pattern matching. As a workaround, I'm parsing the output of show while ignoring the screaming voice at the back of my mind. :) |
Umm, that's bad. Why? |
Yes, like I said it's a workaround. Is there a better way? |
Yeah, but why do you need to do that? I need to know the use case to suggest a solution (or improve the library). |
Oh right. It's a similar situation to the one you described, where an existing application catches SomeException for logging purposes, with the unfortunate side effect of intercepting Error effects. The least intrusive solution seems to be modifying the exception handler to catch "SomeException, except when it's an ErrorWrapper", similar to how catchSync works. |
Hmm. I could in theory change ErrorWrapper to be marked as asynchronous exception (since it's an internal implementation detail), so it's not caught by catchAnySync, but I'm not sure if it's a good idea. |
I like the idea! It's a white lie, but benefits from existing awareness about the perils of catching asynchronous exceptions. |
One place where this is unfortunate is wrapping a Hedgehog effect. For things like |
Ok, I created #283. I'll let it sit for a while and think if this change has a potential to blow up in our faces. |
For example, if a third-party library spawns worker threads and if a job throws, it simply catches SomeException, logs it and retries the job later, as of today internal exceptions representing errors of the
Error
effect wouldn't show any info about the error, just the backtrace.This fixes it at the cost of small API breakage.
TODO changelog