https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

streetsofboston

01/25/2019, 5:55 PM
The documentation says that only
launch
will use the CoroutineExceptionHandler
For
async
, the exception is thrown when using
await()
a

Allan Wang

01/25/2019, 6:34 PM
Isn’t that what’s being asked? It looks like the
exceptionHandler
isn’t being used by
launch
without specifying
job
again
s

streetsofboston

01/25/2019, 6:35 PM
Aghhhh… read too quickly! Thank you for noticing 🙂
n

neworldlt

01/25/2019, 7:38 PM
s

streetsofboston

01/25/2019, 8:03 PM
Very odd… i tried it. This slight modification also makes it work. AS long as
job
is a parameter of
launch
it works….
Copy code
...
  withContext(exceptionHandler) {
      launch(job) { throw RuntimeException("foo") }
  }
  ...
n

neworldlt

01/25/2019, 9:10 PM
Yep, but I am needed the same job for all coroutines inside
withContext
s

streetsofboston

01/25/2019, 9:11 PM
I think we need an expert. 🙂 @elizarov,Could you shed light on this?
5 Views