Skip to content

Commit

Permalink
feat: move exception into auditable method
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Jun 21, 2024
1 parent e87da42 commit d539bc0
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions eox_nelp/pearson_vue/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,18 @@ def import_candidate_demographics_request(cdd_request):
}
payload = update_xml_with_dict(PAYLOAD_CDD, payload)

return api_client.import_candidate_demographics(payload)
response = api_client.import_candidate_demographics(payload)

response = import_candidate_demographics_request(cdd_request)
if response.get("status", "error") == "accepted":
return response

if response.get("status", "error") != "accepted":
logger.info("Import candidate demographics pipeline has failed with the following response: %s", response)
# pylint: disable=broad-exception-raised
raise Exception("Error trying to process import candidate demographics request.")
raise Exception(
response.get("message", "Error trying to process import candidate demographics request.")
)

import_candidate_demographics_request(cdd_request)


def import_exam_authorization(ead_request, **kwargs): # pylint: disable=unused-argument
Expand Down Expand Up @@ -259,13 +264,18 @@ def import_exam_authorization_request(ead_request):
},
}
payload = update_xml_with_dict(PAYLOAD_EAD, payload)
return api_client.import_exam_authorization(payload)
response = api_client.import_exam_authorization(payload)

response = import_exam_authorization_request(ead_request)
if response.get("status", "error") == "accepted":
return response

if response.get("status", "error") != "accepted":
logger.info("Import exam authorization pipeline has failed with the following response: %s", response)
# pylint: disable=broad-exception-raised
raise Exception("Error trying to process import exam authorization request.")
raise Exception(
response.get("message", "Error trying to process import exam authorization request.")
)

import_exam_authorization_request(ead_request)


def get_exam_data(user_id, course_id, **kwargs): # pylint: disable=unused-argument
Expand Down

0 comments on commit d539bc0

Please sign in to comment.