Skip to content

Commit 26b4743

Browse files
Tidy up CORS error catching
1 parent aad2bad commit 26b4743

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/client/auth.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,12 @@ export async function discoverOAuthMetadata(
170170
"MCP-Protocol-Version": opts?.protocolVersion ?? LATEST_PROTOCOL_VERSION
171171
}
172172
});
173-
} catch {
174-
try {
173+
} catch (error) {
174+
// CORS errors come back as TypeError
175+
if (error instanceof TypeError) {
175176
response = await fetch(url);
176-
} catch {
177-
return undefined;
177+
} else {
178+
throw error;
178179
}
179180
}
180181

0 commit comments

Comments
 (0)