Skip to content

Commit 40284e8

Browse files
committed
Move exceptions to a separate module
1 parent d0e208e commit 40284e8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/fastapi_oauth2/base.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,15 @@
55

66
import httpx
77
from oauthlib.oauth2 import WebApplicationClient
8-
from starlette.exceptions import HTTPException
98
from starlette.requests import Request
109
from starlette.responses import RedirectResponse
1110

1211
from .config import JWT_EXPIRES, OAUTH2_REDIRECT_URL
12+
from .exceptions import OAuth2LoginError
1313
from .utils import jwt_create
1414

1515

16-
class OAuth2LoginError(HTTPException):
17-
"""Raised when any login-related error occurs
18-
(such as when user is not verified or if there was an attempt for fake login)
19-
"""
20-
21-
22-
class OAuth2Base:
16+
class OAuth2Core:
2317
"""Base class (mixin) for all SSO providers"""
2418

2519
client_id: str = None

src/fastapi_oauth2/exceptions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from starlette.exceptions import HTTPException
2+
3+
4+
class OAuth2LoginError(HTTPException):
5+
"""Raised when any login-related error occurs
6+
(such as when user is not verified or if there was an attempt for fake login)
7+
"""

0 commit comments

Comments
 (0)