My app is required to respond with a HTTP status code either in the 200 range or the 500 range depending on its status, when probed on endpoints like /liveness and /startup. I can register view functions to respond on these endpoints, but how do I return a 500 status code without having an ugly exception logged to my console?
@app.server.route("/liveness")
def liveness():
if all_good():
return "OK"
else:
raise HTTPException(500, detail="I'm dead")