mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Ignore CancellationException in MiraiConsole.coroutineContext[CoroutineExceptionHandler]
This commit is contained in:
parent
335299275b
commit
7123f1e227
@ -74,6 +74,9 @@ class MiraiConsoleImplementationPure
|
|||||||
) : MiraiConsoleImplementation, CoroutineScope by CoroutineScope(
|
) : MiraiConsoleImplementation, CoroutineScope by CoroutineScope(
|
||||||
NamedSupervisorJob("MiraiConsoleImplementationPure") +
|
NamedSupervisorJob("MiraiConsoleImplementationPure") +
|
||||||
CoroutineExceptionHandler { coroutineContext, throwable ->
|
CoroutineExceptionHandler { coroutineContext, throwable ->
|
||||||
|
if (throwable is CancellationException) {
|
||||||
|
return@CoroutineExceptionHandler
|
||||||
|
}
|
||||||
val coroutineName = coroutineContext[CoroutineName]?.name ?: "<unnamed>"
|
val coroutineName = coroutineContext[CoroutineName]?.name ?: "<unnamed>"
|
||||||
MiraiConsole.mainLogger.error("Exception in coroutine $coroutineName", throwable)
|
MiraiConsole.mainLogger.error("Exception in coroutine $coroutineName", throwable)
|
||||||
}) {
|
}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user