Skip to content

Commit

Permalink
Additional logger output during exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ropable committed Oct 8, 2024
1 parent 2ca0b85 commit 75ac5b5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions prs2/referral/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import logging
import re
from datetime import date, datetime

Expand Down Expand Up @@ -326,7 +327,10 @@ def wfs_getfeature(type_name, crs="EPSG:4326", cql_filter=None, max_features=50)
try:
resp.raise_for_status()
response = resp.json()
except:
except Exception as e:
logger = logging.getLogger("prs")
logger.warning(f"Exception during WFS getFeature request to {url}: {params}")
logger.error(e)
# On exception, return an empty dict.
return {}

Expand All @@ -342,7 +346,10 @@ def query_caddy(q):
try:
resp.raise_for_status()
response = resp.json()
except:
except Exception as e:
logger = logging.getLogger("prs")
logger.warning(f"Exception during query: {url}?q={q}")
logger.error(e)
# On exception, return an empty list.
return []

Expand Down

0 comments on commit 75ac5b5

Please sign in to comment.