https://kotlinlang.org logo
Title
y

ylemoigne

05/09/2018, 10:48 PM
Is it a legal to do this or hackish/will-probably-break-in-future :
window.asDynamic().coroutineDispatcher = window.asCoroutineDispatcher() +
            CoroutineExceptionHandler { coroutineContext, throwable ->
                console.error("Unhandled exception in coroutine", throwable, coroutineContext)
            }
?
d

dave08

05/10/2018, 2:25 AM
@ylemoigne There's an open issue on Githib aboit exceptions being mangled if I understand you properly.. The example you gave is is not too clear what your problem is... But try there, often there a very interesting answers.
y

ylemoigne

05/10/2018, 3:03 AM
Well, in fact, there is an exception thrown in a
switch {...}
in the js code. I did not understand really what was this switch but it seems to be a coroutine state switch/resume things. However there is a big
try {...} catch() {}
around. In the catch block, there is an
if
on a int, in the true branch of the if, the exception if throw, but in the else branch, nothing is done. So ever by hacking my way to replace default dispatcher like in the sample, the exception doesn't go to the coroutine exception handler. If you have a link to the issue, I can take a look to see if behavior match