minor: global exception names
This commit is contained in:
parent
987a050b4b
commit
4a97789c1a
1 changed files with 7 additions and 3 deletions
|
|
@ -1,21 +1,25 @@
|
|||
"""
|
||||
Global exceptions
|
||||
|
||||
Exports:
|
||||
- UnprocessableContentException
|
||||
- ConflictException
|
||||
"""
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
|
||||
class UnprocessableContent(HTTPException):
|
||||
class UnprocessableContentException(HTTPException):
|
||||
def __init__(self, message: Optional[str] = None) -> None:
|
||||
detail = "Not authorized" if not message else message
|
||||
detail = "Unprocessable content" if not message else message
|
||||
super().__init__(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
|
||||
detail=detail,
|
||||
)
|
||||
|
||||
|
||||
class Conflict(HTTPException):
|
||||
class ConflictException(HTTPException):
|
||||
def __init__(self, message: Optional[str] = None) -> None:
|
||||
detail = "Conflict" if not message else message
|
||||
super().__init__(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue