Skip to content

Commit e5050ee

Browse files
fix eception
1 parent bef1ab8 commit e5050ee

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

app/exceptions/UserException.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
from fastapi import status
1+
from fastapi import HTTPException, status
22

33

4-
class UsersException(Exception):
5-
def __init__(self, message, status_code):
6-
self.message = message
7-
self.status_code = status_code
8-
9-
10-
class UserNotFound(UsersException):
4+
class UserNotFound(HTTPException):
115
def __init__(self, id: int):
12-
super().__init__(f"User with id {id} not found",
13-
status.HTTP_404_NOT_FOUND)
6+
status_code = status.HTTP_404_NOT_FOUND
7+
detail = f"User with id {id} not found"
8+
super().__init__(status_code=status_code, detail=detail)

0 commit comments

Comments
 (0)