Commit 74519919 authored by Him188's avatar Him188

Catch missing exceptions thrown under Bot CoroutineScope

parent 5b4e99c5
......@@ -38,7 +38,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
private val botJob = SupervisorJob(configuration.parentCoroutineContext[Job])
override val coroutineContext: CoroutineContext =
configuration.parentCoroutineContext + botJob + (configuration.parentCoroutineContext[CoroutineExceptionHandler]
?: CoroutineExceptionHandler { _, e -> e.logStacktrace("An exception was thrown under a coroutine of Bot") })
?: CoroutineExceptionHandler { _, e -> logger.error("An exception was thrown under a coroutine of Bot", e) })
@Suppress("CanBePrimaryConstructorProperty") // for logger
final override val account: BotAccount = account
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment