Skip to content

Commit

Permalink
Handle attribute error with a try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnMwashuma committed Nov 11, 2024
1 parent 0b835b0 commit 3581980
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tally_ho/apps/tally/templatetags/app_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ def get_audit_action_name(action_prior_enum):
:returns: Action prior name as a String.
"""
return get_action_prior_label_by_number(action_prior_enum.value)
action_prior_name = None
try:
action_prior_name =\
get_action_prior_label_by_number(action_prior_enum.value)
except AttributeError:
pass

return action_prior_name

def get_audti_resolution_label_by_number(choice_number):
for number, choice_label in AuditResolution.choices():
Expand All @@ -73,4 +80,11 @@ def get_audit_resolution_name(audit_resolution_enum):
:returns: Audit resolution name as a String.
"""
return get_audti_resolution_label_by_number(audit_resolution_enum.value)
audit_resolution_name = None
try:
audit_resolution_name =\
get_audti_resolution_label_by_number(audit_resolution_enum.value)
except AttributeError:
pass

return audit_resolution_name

0 comments on commit 3581980

Please sign in to comment.