Skip to content

Commit fe43361

Browse files
committed
GH-22: Merge two exception cases into one
1 parent 9ff9d5d commit fe43361

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/fastapi_oauth2/core.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from .claims import Claims
2121
from .client import OAuth2Client
2222
from .exceptions import OAuth2AuthenticationError
23-
from .exceptions import OAuth2BadCredentialsError
2423
from .exceptions import OAuth2InvalidRequestError
2524

2625

@@ -120,10 +119,8 @@ async def token_data(self, request: Request, **httpx_client_args) -> dict:
120119
response = await session.post(token_url, headers=headers, content=content)
121120
self._oauth_client.parse_request_body_response(json.dumps(response.json()))
122121
return self.standardize(self.backend.user_data(self.access_token))
123-
except OAuth2Error as e:
122+
except (OAuth2Error, httpx.HTTPError) as e:
124123
raise OAuth2InvalidRequestError(400, str(e))
125-
except httpx.HTTPError as e:
126-
raise OAuth2BadCredentialsError(400, str(e))
127124
except (AuthException, Exception) as e:
128125
raise OAuth2AuthenticationError(401, str(e))
129126

0 commit comments

Comments
 (0)