Flask errorhandler isn't called for view that returns 404
<p>With the following functions, I'd expect the error handler to get called when the view returns 404. But it does not trigger. Why doesn't a 404 error handler get called when a view returns 404?</p>

<pre><code>@app.errorhandler(404)
def error(e):
    return render_template('error.html'), 404


@app.route('/error/')
def error_test():
    return '', 404
</code></pre>

<p>You aren't triggering the error. You can use <code>abort</code> for that. </p>

<pre><code>from flask import abort

@app.route('/error/')
def error_test():
    abort(404)
</code></pre>

python flask