mirror of
https://github.com/mamoe/mirai.git
synced 2024-12-29 10:00:13 +08:00
[core] Ensure Bot.login always show actual login cause whenever a failure in Bot.close
happens
This commit is contained in:
parent
2252683cee
commit
04b16fe2e4
@ -146,11 +146,16 @@ internal abstract class AbstractBot constructor(
|
||||
e.unwrapForPublicApi()
|
||||
} else e
|
||||
|
||||
// close bot if it hadn't been done during `resumeConnection()`
|
||||
if (!components[SsoProcessor].firstLoginSucceed) {
|
||||
close(cause) // failed to do first login, close bot
|
||||
} else if (cause is LoginFailedException && cause.killBot) {
|
||||
close(cause) // re-login failed and has caused bot being somehow killed by server
|
||||
try {
|
||||
// close bot if it hadn't been done during `resumeConnection()`
|
||||
if (!components[SsoProcessor].firstLoginSucceed) {
|
||||
close(cause) // failed to do first login, close bot
|
||||
} else if (cause is LoginFailedException && cause.killBot) {
|
||||
close(cause) // re-login failed and has caused bot being somehow killed by server
|
||||
}
|
||||
} catch (errorInClose: Throwable) {
|
||||
errorInClose.addSuppressed(cause)
|
||||
throw errorInClose
|
||||
}
|
||||
|
||||
throw cause
|
||||
|
Loading…
Reference in New Issue
Block a user