INNER CODE UNIT · Python

TestExceptionCode

akutayural/APIException · benchmark/test_app/main.py:8

class TestExceptionCode(BaseExceptionCode):
    FAIL_CASE = ("FAIL-500", "Failure", "Something failed.")


@app.get("/ok")
async def ok():
    return {"message": "ok"}


@app.get("/error")
async def error():
    raise APIException(
        error_code=TestExceptionCode.FAIL_CASE,
        http_status_code=500,
        status=ExceptionStatus.FAIL
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…