is catching, reporting, and ignoring. I don't see any means to tell
supervisorScope
to not catch fatal errors. Am I missing something? Is there a better pattern? (I guess I could just use `try..catch`to keep non-fatal errors from cancelling the parent?) Fatal errors = OOM, VirtualMachineError, ThreadDeath, LinkageError, InterruptedException, CancellationException.
Don Mitchell
11/22/2024, 3:47 PM
Reading more about
supervisorScope
and I think it's too robust for our use 😞 . From what I can tell, it's design is to catch all errors even fatal ones allowing the throwing coroutine to die but none of its siblings nor future ones. I may add a side effect to the CoroutineExceptionHandler to set a semaphore if fatal error and use that to abandon the top level iteration unless anyone has a better idea.
y
Youssef Shoaib [MOD]
11/22/2024, 7:08 PM
I mean, theoretically an OOM that happened deep in a coroutine might not affect its siblings after that coroutine is dead, so maybe you actually want this behaviour? Also, I think you could create a version of
SupervisorJob
using Arrow's
nonFatalOrThrow
j
Jeremiah Van Offeren
11/22/2024, 8:14 PM
Believe this might be what your looking for, you can create a exception handler and add it to a scope you create or pass it in your launch call. it extends