mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-24 14:30:09 +08:00
Catch missing exceptions thrown under Bot CoroutineScope
This commit is contained in:
parent
5b4e99c52d
commit
7451991973
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user