Skip to content

Commit

Permalink
Add general exception to catch things other than AssertionError
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelltaylor committed Jun 20, 2024
1 parent 150cfb0 commit a3fc65e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions florist/api/routes/server/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ async def change_job_status(job_id: str, status: JobStatus, request: Request) ->
assert job_in_db is not None, f"Job {job_id} not found"
await job_in_db.set_status(status, request.app.database)
return JSONResponse(content={"status": "success"})
except AssertionError as e:
return JSONResponse(content={"error": str(e)}, status_code=400)
except AssertionError as assertion_e:
return JSONResponse(content={"error": str(assertion_e)}, status_code=400)

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
except Exception as general_e:
return JSONResponse(content={"error": str(general_e)}, status_code=500)

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.

0 comments on commit a3fc65e

Please sign in to comment.