Added all other missing API endpoints.
Some checks failed
checks-impure / test (pull_request) Successful in 33s
checks / test (pull_request) Failing after 1m54s

This commit is contained in:
2023-11-27 14:01:42 +01:00
parent b4a314f0cd
commit efebe6171e
4 changed files with 176 additions and 56 deletions

View File

@@ -3,12 +3,27 @@ import logging
from fastapi import Request, status
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
from sqlalchemy.exc import SQLAlchemyError
from ..errors import ClanError
log = logging.getLogger(__name__)
def sql_error_handler(request: Request, exc: SQLAlchemyError) -> JSONResponse:
log.exception(exc)
detail = [
{
"loc": [],
"msg": exc._message(),
}
]
return JSONResponse(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
content=jsonable_encoder(dict(detail=detail)),
)
def clan_error_handler(request: Request, exc: ClanError) -> JSONResponse:
log.error("ClanError: %s", exc)
detail = [