From 173302608e574667cff20df149ecc7ccb5b84272 Mon Sep 17 00:00:00 2001 From: "Hassan D. M. Sambo" Date: Thu, 12 Oct 2023 18:01:49 -0400 Subject: [PATCH] Necessary change to prevent check_sequential_award_numbers from cratching --- .../audit/intakelib/checks/check_missing_award_numbers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/audit/intakelib/checks/check_missing_award_numbers.py b/backend/audit/intakelib/checks/check_missing_award_numbers.py index b0173274a1..7cc93dc222 100644 --- a/backend/audit/intakelib/checks/check_missing_award_numbers.py +++ b/backend/audit/intakelib/checks/check_missing_award_numbers.py @@ -1,9 +1,11 @@ +from django.core.exceptions import ValidationError import logging from audit.intakelib.intermediate_representation import get_range_by_name from .util import get_message, build_cell_error_tuple logger = logging.getLogger(__name__) + # FIXME: We need comments on all the validations? def missing_award_numbers(ir): ars = get_range_by_name(ir, "award_reference") @@ -16,5 +18,6 @@ def missing_award_numbers(ir): ir, ars, index, get_message("check_missing_award_numbers") ) ) - - return errors + if len(errors) > 0: + logger.info("Raising a validation error.") + raise ValidationError(errors)