Explorar o código

Catch missing exceptions thrown under Bot CoroutineScope

Him188 %!s(int64=6) %!d(string=hai) anos
pai
achega
7451991973

+ 1 - 1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt

@@ -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