Skip to content

Commit e08d213

Browse files
committed
BaseException -> CustomException rename
1 parent 7c11081 commit e08d213

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

app/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
app.include_router(api.api_router)
2424

2525

26-
@app.exception_handler(exps.BaseException)
27-
async def exception_handler(request, exc: exps.BaseException):
26+
@app.exception_handler(exps.CustomException)
27+
async def exception_handler(request, exc: exps.CustomException):
2828
return JSONResponse(
2929
status_code=exc.status_code,
3030
content={'detail': exc.message},

app/core/exps.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@
33
"""
44

55

6-
class BaseException(Exception):
6+
class CustomException(Exception):
77
def __init__(self, message: str, status_code: int = 500):
88
super().__init__(message)
99
self.message = message
1010
self.status_code = status_code
1111

1212

1313
# Users
14-
class UserExistsException(BaseException):
14+
class UserExistsException(CustomException):
1515
def __init__(self):
1616
super().__init__('User is already taken.', status_code=409)
1717

1818

19-
class UserNotFoundException(BaseException):
19+
class UserNotFoundException(CustomException):
2020
def __init__(self):
2121
super().__init__('User not found.', status_code=404)
2222

2323

24-
class UserIsCorrectException(BaseException):
24+
class UserIsCorrectException(CustomException):
2525
def __init__(self):
2626
super().__init__('User is correct.', status_code=401)
2727

2828

2929
# Tokens
30-
class TokenInvalidException(BaseException):
30+
class TokenInvalidException(CustomException):
3131
def __init__(self):
3232
super().__init__('Invalid token.', status_code=401)
3333

3434

35-
class TokenExpiredException(BaseException):
35+
class TokenExpiredException(CustomException):
3636
def __init__(self):
3737
super().__init__('Token expired.', status_code=401)

0 commit comments

Comments
 (0)