Skip to content

Commit 553b8dc

Browse files
authored
Merge pull request #107 from kukume/fix1
catch exception in websocket
2 parents b90032e + 3d09ef7 commit 553b8dc

File tree

1 file changed

+6
-1
lines changed
  • simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/internal

1 file changed

+6
-1
lines changed

simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/commonMain/kotlin/love/forte/simbot/component/onebot/v11/core/bot/internal/OneBotBotImpl.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,12 @@ internal class OneBotBotImpl(
426426
}
427427

428428
// 等待关闭完成
429-
val reason = currentSession.closeReason.await()
429+
val reason = kotlin.runCatching {
430+
currentSession.closeReason.await()
431+
}.getOrElse { e ->
432+
logger.debug("Failed to get close reason for session: {}", e.message, e)
433+
null
434+
}
430435
logger.debug("Session {} done. The reason: {}", currentSession, reason)
431436
}
432437

0 commit comments

Comments
 (0)