kotlinx.coroutines icon indicating copy to clipboard operation
kotlinx.coroutines copied to clipboard

Provide an API to check whether debug mode is enabled

Open qwwdfsad opened this issue 4 years ago • 1 comments

We already have a notion of debug mode in our documentation, but we do not have an API to check whether the mode is enabled.

It can be useful in multiple scenarios:

  • To write unit tests that work both with and without debug mode
    • We already do that in our MPP tests
  • To verify and debug program behaviour (see #2550)
  • To write your own extensions to coroutines that may exhibit an additional behaviour when debug mode is enabled (stacktrace for cancellation exception subclasses, context markers and so on)

qwwdfsad avatar Feb 24 '21 15:02 qwwdfsad

Also, it's worth adding unwrap function and separate stacktrace recovery check.

We already bump into this in our own modules: https://github.com/Kotlin/kotlinx.coroutines/pull/2646/commits/89fd2c179efcd5a80d5dd2f12ada5a75734e9326

qwwdfsad avatar Apr 19 '21 15:04 qwwdfsad