Skip to content

Commit d2a1698

Browse files
committed
added ConnectionError exception handling in create_locations
1 parent a4d1b78 commit d2a1698

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

spp_import_dci_api/models/fetch_crvs_beneficiary.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,13 @@ def create_locations(self):
201201

202202
if location_path:
203203
url = f"{data_source_id.url}{location_path}"
204-
response = requests.get(url, timeout=constants.REQUEST_TIMEOUT)
205-
if response.ok:
206-
result = response.json()
207-
self.process_location(result)
204+
try:
205+
response = requests.get(url, timeout=constants.REQUEST_TIMEOUT)
206+
if response.ok:
207+
result = response.json()
208+
self.process_location(result)
209+
except requests.exceptions.ConnectionError as e:
210+
_logger.error(e)
208211

209212
def get_parent(self):
210213
"""

0 commit comments

Comments
 (0)