phase-2: asset register, detail overview, asset picker, attachments
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from fastapi import HTTPException, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
|
||||
class CodedHTTPException(HTTPException):
|
||||
def __init__(self, status_code: int, detail: str, code: str):
|
||||
super().__init__(status_code=status_code, detail=detail)
|
||||
self.code = code
|
||||
|
||||
|
||||
async def coded_http_exception_handler(request: Request, exc: CodedHTTPException) -> JSONResponse:
|
||||
return JSONResponse(
|
||||
status_code=exc.status_code,
|
||||
content={"detail": exc.detail, "code": exc.code},
|
||||
headers=exc.headers,
|
||||
)
|
||||
Reference in New Issue
Block a user