Merge pull request #263 from alphagov/error-handling

Fix bug in error handlers.
This commit is contained in:
Rebecca Law
2016-03-11 10:52:53 +00:00
5 changed files with 13 additions and 10 deletions

View File

@@ -184,15 +184,11 @@ def register_errorhandlers(application):
@application.errorhandler(HTTPError)
def render_http_error(error):
error_code = getattr(error, 'code', 500)
error_code = error.status_code
if error_code not in [401, 404, 403, 500]:
error_code = 500
return _error_response(error_code)
@application.errorhandler(400)
def handle_bad_request(error):
return _error_response(404)
@application.errorhandler(404)
def handle_not_found(error):
return _error_response(404)

View File

@@ -1,5 +1,4 @@
from flask import (
abort,
render_template,
session,
flash
@@ -25,7 +24,7 @@ def service_dashboard(service_id):
if session.get('invited_user'):
session.pop('invited_user', None)
service_name = service['data']['name']
message = 'You have sucessfully accepted your invitation and been added to {}'.format(service_name)
message = 'You have successfully accepted your invitation and been added to {}'.format(service_name)
flash(message, 'default_with_tick')
return render_template(