Skip to content

Commit 43bf9d7

Browse files
committed
Create an exceptions module
1 parent abcd8cc commit 43bf9d7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/fastapi_oauth2/core.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@
1313
from oauthlib.oauth2.rfc6749.errors import CustomOAuth2Error
1414
from social_core.backends.oauth import BaseOAuth2
1515
from social_core.strategy import BaseStrategy
16-
from starlette.exceptions import HTTPException
1716
from starlette.requests import Request
1817
from starlette.responses import RedirectResponse
1918

2019
from .claims import Claims
2120
from .client import OAuth2Client
22-
23-
24-
class OAuth2LoginError(HTTPException):
25-
"""Raised when any login-related error occurs."""
21+
from .exceptions import OAuth2LoginError
2622

2723

2824
class OAuth2Strategy(BaseStrategy):

src/fastapi_oauth2/exceptions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from starlette.exceptions import HTTPException
2+
3+
4+
class OAuth2LoginError(HTTPException):
5+
"""Raised when any login-related error occurs."""

0 commit comments

Comments
 (0)