Refactored register_errorhandlers so that it handles HTTPError

Remove most cases where we catch HTTPError
This commit is contained in:
Rebecca Law
2016-03-10 11:53:29 +00:00
parent 2acc496734
commit f6d98b63ea
14 changed files with 110 additions and 247 deletions

View File

@@ -15,7 +15,6 @@ from flask import (
)
from flask_login import login_required, current_user
from notifications_python_client.errors import HTTPError
from utils.template import Template
from utils.recipients import RecipientCSV, first_column_heading
@@ -80,13 +79,8 @@ def choose_template(service_id, template_type):
if template_type not in ['email', 'sms']:
abort(404)
try:
jobs = job_api_client.get_job(service_id)['data']
except HTTPError as e:
if e.status_code == 404:
abort(404)
else:
raise e
jobs = job_api_client.get_job(service_id)['data']
return render_template(
'views/choose-template.html',
templates=[