File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import kotlinx.serialization.json.JsonElement
1010import kotlinx.serialization.json.JsonNull
1111import kotlinx.serialization.json.JsonObject
1212import kotlinx.serialization.json.JsonPrimitive
13+ import kotlin.coroutines.cancellation.CancellationException
1314
1415/* *
1516 * Options for configuring the MCP client.
@@ -100,7 +101,11 @@ public open class Client(
100101 notification(InitializedNotification ())
101102 } catch (error: Throwable ) {
102103 close()
103- throw error
104+ if (error !is CancellationException ) {
105+ throw IllegalStateException (" Error connecting to transport" , error)
106+ } else {
107+ throw error
108+ }
104109 }
105110 }
106111
You can’t perform that action at this time.
0 commit comments