diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/TIMBotNetworkHandler.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/TIMBotNetworkHandler.kt index 3e729c909..69dba29eb 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/TIMBotNetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/protocol/tim/TIMBotNetworkHandler.kt @@ -44,8 +44,9 @@ internal class TIMBotNetworkHandler internal constructor(coroutineContext: Corou override val coroutineContext: CoroutineContext = - coroutineContext + NetworkDispatcher + CoroutineExceptionHandler { _, e -> - bot.logger.error("An exception was thrown in a coroutine under TIMBotNetworkHandler", e) + coroutineContext + NetworkDispatcher + CoroutineExceptionHandler { context, e -> + bot.logger.error("An exception was thrown in ${context[CoroutineName]?.let { "coroutine $it" } + ?: "an unnamed coroutine"} under TIMBotNetworkHandler", e) } + supervisor