Skip to content

Commit

Permalink
Remove exception handler that prints to the console (conda-incubator#…
Browse files Browse the repository at this point in the history
…1037)

Co-authored-by: Peyton Murray <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 9, 2025
1 parent 2a00467 commit 2588aa3
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions conda-store-server/conda_store_server/_internal/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ async def conda_store_middleware(request: Request, call_next):
return response

@app.exception_handler(HTTPException)
async def http_exception_handler(request, exc):
async def http_exception_handler(
request: Request, exc: HTTPException
) -> JSONResponse:
return JSONResponse(
{
"status": "error",
Expand All @@ -265,14 +267,6 @@ async def http_exception_handler(request, exc):
status_code=exc.status_code,
)

# Prints exceptions to the terminal
# https://fastapi.tiangolo.com/tutorial/handling-errors/#re-use-fastapis-exception-handlers
# https://github.com/tiangolo/fastapi/issues/1241
@app.exception_handler(Exception)
async def exception_handler(request, exc):
print(exc)
return await http_exception_handler(request, exc)

app.include_router(
self.authentication.router,
prefix=trim_slash(self.url_prefix),
Expand Down

0 comments on commit 2588aa3

Please sign in to comment.