Skip to content

Commit 1332f52

Browse files
committed
fix: negated condition
1 parent c286e04 commit 1332f52

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

core/context/mcp/MCPConnection.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ class MCPConnection {
221221
);
222222
await this.client.connect(transport, {});
223223
this.transport = transport;
224-
} else if (!this.options.type) {
224+
} else if (this.options.type) {
225+
throw new Error(
226+
`Unsupported transport type: ${this.options.type}`,
227+
);
228+
} else {
225229
try {
226230
const transport = this.constructHttpTransport({
227231
...this.options,
@@ -243,10 +247,6 @@ class MCPConnection {
243247
);
244248
}
245249
}
246-
} else {
247-
throw new Error(
248-
`Unsupported transport type: ${this.options.type}`,
249-
);
250250
}
251251
}
252252

extensions/cli/src/services/MCPService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ export class MCPService
372372
} else if (serverConfig.type === "streamable-http") {
373373
const transport = this.constructHttpTransport(serverConfig);
374374
await client.connect(transport, {});
375-
} else if (!serverConfig.type) {
375+
} else if (serverConfig.type) {
376+
throw new Error(`Unsupported transport type: ${serverConfig.type}`);
377+
} else {
376378
try {
377379
const transport = this.constructHttpTransport(serverConfig);
378380
await client.connect(transport, {});
@@ -392,8 +394,6 @@ export class MCPService
392394
);
393395
}
394396
}
395-
} else {
396-
throw new Error(`Unsupported transport type: ${serverConfig.type}`);
397397
}
398398
}
399399

0 commit comments

Comments
 (0)