Skip to content

Commit

Permalink
capture more generic error message
Browse files Browse the repository at this point in the history
  • Loading branch information
FuhuXia committed Aug 30, 2024
1 parent 1fb1a54 commit 453dd7f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ckan/lib/search/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,13 +479,11 @@ def _check_query_parser(param: str, value: Any):
log.error("Connection Error: Failed to connect to Solr server.")
raise SolrConnectionError("Solr returned an error while searching.")

if "Error 401 Bad credentials" in e.args[0]:
log.error("Connection Error: 401 Bad credentials.")
raise SolrConnectionError("Solr returned an error while searching.")


if "503 Service Temporarily Unavailable" in e.args[0]:
log.error("Connection Error: 503 Service Temporarily Unavailable.")
if "(HTTP 504)" in e.args[0] or \
"(HTTP 503)" in e.args[0] or \
"(HTTP 502)" in e.args[0] or \
"(HTTP 401)" in e.args[0]:
log.error(f"Connection Error: {e.args[0]}")
raise SolrConnectionError("Solr returned an error while searching.")

raise SearchError('SOLR returned an error running query: %r Error: %r' %
Expand Down

0 comments on commit 453dd7f

Please sign in to comment.