From c1bf48f91e788f0c1d5f85b41fa038df409e51de Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 8 Mar 2016 17:50:18 +0000 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20catch=20exceptions=20if=20API?= =?UTF-8?q?=20fails=20to=20create=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no good reason why the API should fail to create a job at this point. If it’s returning a 404, this is an error, and we should be monitoring for it. So we should let it raise, and throw a 500. --- app/main/views/send.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 8125502db..27d1ffe4d 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -247,25 +247,19 @@ def start_job(service_id, upload_id): upload_data = session['upload_data'] services_dao.get_service_by_id_or_404(service_id) - if request.files or not session['upload_data'].get('valid'): + if request.files or not upload_data.get('valid'): # The csv was invalid, validate the csv again return send_messages(service_id, upload_data.get('template_id')) session.pop('upload_data') - try: - job_api_client.create_job( - upload_id, - service_id, - upload_data.get('template_id'), - upload_data.get('original_file_name'), - upload_data.get('notification_count') - ) - except HTTPError as e: - if e.status_code == 404: - abort(404) - else: - raise e + job_api_client.create_job( + upload_id, + service_id, + upload_data.get('template_id'), + upload_data.get('original_file_name'), + upload_data.get('notification_count') + ) return redirect( url_for('main.view_job', service_id=service_id, job_id=upload_id)