From 0f1e9a3dd26606c2b23f56e1ff79252f8cb0209e Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 28 Nov 2019 20:35:23 +0800 Subject: [PATCH] Make log clear --- .../network/protocol/tim/TIMBotNetworkHandler.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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