mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Don’t catch exceptions if API fails to create job
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.
This commit is contained in:
@@ -247,25 +247,19 @@ def start_job(service_id, upload_id):
|
|||||||
upload_data = session['upload_data']
|
upload_data = session['upload_data']
|
||||||
services_dao.get_service_by_id_or_404(service_id)
|
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
|
# The csv was invalid, validate the csv again
|
||||||
return send_messages(service_id, upload_data.get('template_id'))
|
return send_messages(service_id, upload_data.get('template_id'))
|
||||||
|
|
||||||
session.pop('upload_data')
|
session.pop('upload_data')
|
||||||
|
|
||||||
try:
|
job_api_client.create_job(
|
||||||
job_api_client.create_job(
|
upload_id,
|
||||||
upload_id,
|
service_id,
|
||||||
service_id,
|
upload_data.get('template_id'),
|
||||||
upload_data.get('template_id'),
|
upload_data.get('original_file_name'),
|
||||||
upload_data.get('original_file_name'),
|
upload_data.get('notification_count')
|
||||||
upload_data.get('notification_count')
|
)
|
||||||
)
|
|
||||||
except HTTPError as e:
|
|
||||||
if e.status_code == 404:
|
|
||||||
abort(404)
|
|
||||||
else:
|
|
||||||
raise e
|
|
||||||
|
|
||||||
return redirect(
|
return redirect(
|
||||||
url_for('main.view_job', service_id=service_id, job_id=upload_id)
|
url_for('main.view_job', service_id=service_id, job_id=upload_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user