Skip to content

Commit

Permalink
gracefully handle relation not existing
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Sep 25, 2023
1 parent bfc8230 commit dbfa701
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion care/facility/static_data/icd11.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import contextlib
import json

from django.db.utils import ProgrammingError
from littletable import Table

from care.facility.models.icd11_diagnosis import ICD11Diagnosis
Expand All @@ -12,7 +13,11 @@ def fetch_data():


def fetch_from_db():
return ICD11Diagnosis.objects.all().values("id", "label")
try:
return ICD11Diagnosis.objects.all().values("id", "label")
except ProgrammingError as e:
print(e)
return []


ICDDiseases = Table("ICD11")
Expand Down

0 comments on commit dbfa701

Please sign in to comment.