CLOVIS
12/05/2022, 10:07 PMYoussef Shoaib [MOD]
12/06/2022, 12:17 AMRaise<SomeError>
require the caller to be suspend
though?simon.vergauwen
12/06/2022, 8:20 AMRaise<SomeError>
doesn't require suspension anymore.Youssef Shoaib [MOD]
12/06/2022, 8:21 AMsimon.vergauwen
12/06/2022, 8:26 AMNoStackTrace
exception otherwise it doesn't respect the rules of Kotlin Coroutines.simon.vergauwen
12/06/2022, 8:26 AMsimon.vergauwen
12/06/2022, 8:27 AMconstructor
with context receivers. So you can enforce a constructor
being called from within a certain error handler.CLOVIS
12/06/2022, 8:29 AMEither
CLOVIS
12/06/2022, 8:31 AMsimon.vergauwen
12/06/2022, 8:35 AMThrowable
that avoids the creation of the stacktrace on construction.
The stacktrace creation is so expensive because it requires native calls and requires digging and interacting with the VM.
KotlinX Coroutines takes the same approach with JobCancellationException
, so it's an established pattern for cancelling Kotlin Coroutines without the performance penalty.