examples/flask/13/app.py
from flask import Flask
app = Flask(__name__)

@app.route("/")
def main():
    return '''
Main
<a href="/bad">bad</a>
'''

@app.route("/bad")
def bad():
    raise Exception("This is a bad page")
    return 'Bad page'

# Will not trigger in debug mode!
# @app.errorhandler(500)
# def not_found(e):
#     #raise Exception("Oups")
#     return "Our Page crashed", 500

$ FLASK_APP=echo.py FLASK_DEBUG=0  flask run
curl -I http://localhost:5000/not

HTTP/1.0 500 INTERNAL SERVER ERROR