INNER CODE UNIT · Python
timeout_exception_handler
Quenary/tugtainer · agent/app.py:40
async def timeout_exception_handler(request: Request, exc: asyncio.TimeoutError):
raise HTTPException(
500,
"Timeout error. The problem is most likely related to connecting to the docker host.",
)
@app.exception_handler(DockerException)
async def docker_exception_handler(
request: Request,
exc: DockerException,
):
detail = "Docker Exception"
if exc.stdout:
detail += f"\nstdout: {exc.stdout}"
if exc.stderr:
detail += f"\nstderr: {exc.stderr}"
raise HTTPException(status.HTTP_424_FAILED_DEPENDENCY, detail)