Skip to content

Commit 7d32816

Browse files
kltmclaude
andcommitted
Add JSON decode error handling to get_bioentity_isoforms
Aligns with the existing pattern in run_solr_on and gu_run_solr_text_on. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8014bcb commit 7d32816

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/utils/golr_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ def get_bioentity_isoforms(entity_id: str) -> list[str]:
166166
timeout_seconds = 60
167167
response = requests.get(query, timeout=timeout_seconds)
168168
response.raise_for_status()
169-
data = response.json()
169+
try:
170+
data = response.json()
171+
except requests.exceptions.JSONDecodeError as e:
172+
logger.error(f"Failed to parse JSON response from GOLr: {e}")
173+
raise ValueError(f"Invalid JSON response from GOLr server: {e}") from e
170174
# Facet field response is alternating [value, count, value, count, ...]
171175
facet_list = (
172176
data.get("facet_counts", {})

0 commit comments

Comments
 (0)