Skip to content
thesarfo

Note

Flask Error Handlers

Registering a custom error handler for an HTTP status code in Flask.

views 0

The way you create error handlers in flask is similar to how you create routes except you will use a different decorator. see below

@errors.app_errorhandler(404) # the beginning 'errors' is just the name of your blueprint if there's one
def error_404(error):
return render_template('errors/404.html'), 404

After that just create your templates and write some display