mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-22 21:44:18 +02:00
Use specific ValidationError instead of broad Exception catch
Addresses PR feedback to use more specific exception handling for URL validation failures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
40ce687d0d
commit
7b5ef3e5e5
1 changed files with 2 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ from mcp.shared.auth import (
|
|||
OAuthClientInformationFull,
|
||||
OAuthToken,
|
||||
)
|
||||
from pydantic import AnyHttpUrl, SecretStr
|
||||
from pydantic import AnyHttpUrl, SecretStr, ValidationError
|
||||
|
||||
from fastmcp.server.auth.auth import (
|
||||
ClientRegistrationOptions,
|
||||
|
|
@ -183,7 +183,7 @@ class BearerAuthProvider(OAuthProvider):
|
|||
# This allows the issuer claim validation to work with string issuers per RFC 7519
|
||||
try:
|
||||
issuer_url = AnyHttpUrl(issuer) if issuer else "https://fastmcp.example.com"
|
||||
except Exception:
|
||||
except ValidationError:
|
||||
# Issuer is not a valid URL, use default for parent class
|
||||
issuer_url = "https://fastmcp.example.com"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue