Fix the difference in error handling between Kotlin and Typescript implementations in onClose (#31)
Makes the error handling behavior consistent between Kotlin and TypeScript implementations when handling connection closure events.
This commit is contained in:
parent
d8a8f89465
commit
9931b1e666
1 changed files with 5 additions and 5 deletions
|
|
@ -191,15 +191,15 @@ public abstract class Protocol<SendRequestT : Request, SendNotificationT : Notif
|
|||
}
|
||||
|
||||
private fun onClose() {
|
||||
val error = McpError(ErrorCode.Defined.ConnectionClosed.code, "Connection closed")
|
||||
for (handler in responseHandlers.values) {
|
||||
handler(null, error)
|
||||
}
|
||||
|
||||
responseHandlers.clear()
|
||||
progressHandlers.clear()
|
||||
transport = null
|
||||
onclose()
|
||||
|
||||
val error = McpError(ErrorCode.Defined.ConnectionClosed.code, "Connection closed")
|
||||
for (handler in responseHandlers.values) {
|
||||
handler(null, error)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onError(error: Throwable) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue