fix: negated condition

This commit is contained in:
Dallin Romney 2025-09-26 10:42:46 -07:00
parent c286e046f4
commit 1332f52839
2 changed files with 8 additions and 8 deletions

View file

@ -221,7 +221,11 @@ class MCPConnection {
);
await this.client.connect(transport, {});
this.transport = transport;
} else if (!this.options.type) {
} else if (this.options.type) {
throw new Error(
`Unsupported transport type: ${this.options.type}`,
);
} else {
try {
const transport = this.constructHttpTransport({
...this.options,
@ -243,10 +247,6 @@ class MCPConnection {
);
}
}
} else {
throw new Error(
`Unsupported transport type: ${this.options.type}`,
);
}
}

View file

@ -372,7 +372,9 @@ export class MCPService
} else if (serverConfig.type === "streamable-http") {
const transport = this.constructHttpTransport(serverConfig);
await client.connect(transport, {});
} else if (!serverConfig.type) {
} else if (serverConfig.type) {
throw new Error(`Unsupported transport type: ${serverConfig.type}`);
} else {
try {
const transport = this.constructHttpTransport(serverConfig);
await client.connect(transport, {});
@ -392,8 +394,6 @@ export class MCPService
);
}
}
} else {
throw new Error(`Unsupported transport type: ${serverConfig.type}`);
}
}