template for service rather than hub
Previous template structure had direct handling of auth. This structure is designed to get auth from the hub instead.
This commit is contained in:
parent
ed4a3fe0b8
commit
ea9803536a
27 changed files with 223 additions and 117 deletions
|
|
@ -1,3 +1,28 @@
|
|||
"""
|
||||
Global exceptions
|
||||
"""
|
||||
|
||||
Exports:
|
||||
- UnprocessableContentException
|
||||
- ConflictException
|
||||
"""
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
|
||||
|
||||
class UnprocessableContentException(HTTPException):
|
||||
def __init__(self, message: Optional[str] = None) -> None:
|
||||
detail = "Unprocessable content" if not message else message
|
||||
super().__init__(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_CONTENT,
|
||||
detail=detail,
|
||||
)
|
||||
|
||||
|
||||
class ConflictException(HTTPException):
|
||||
def __init__(self, message: Optional[str] = None) -> None:
|
||||
detail = "Conflict" if not message else message
|
||||
super().__init__(
|
||||
status_code=status.HTTP_409_CONFLICT,
|
||||
detail=detail,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue