How do I make an error handler with flask

Solution
@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404