Skip to content

Split Solr errors into specific exceptions#2169

Open
alastair wants to merge 2 commits into
masterfrom
search-error-split
Open

Split Solr errors into specific exceptions#2169
alastair wants to merge 2 commits into
masterfrom
search-error-split

Conversation

@alastair

Copy link
Copy Markdown
Member

Description
Previously all errors from solr turned into a single exception. this meant that any error was grouped into the same issue in sentry, even if the causes were different. Split each type of error into a separate exception so that we can track different classes of errors.
Upgrade pysolr to allow us to specifically identify a timeout based on causing exception rather than inspecting the string of the exception text.

Deployment steps:

alastair added 2 commits July 21, 2026 10:16
pysolr swallows the underlying error and re-raises a generic SolrError.
Upstream PR #544 (merged, not yet released) adds explicit
`raise ... from err`, exposing the original exception via __cause__. Pin
to that commit so timeout detection can key off the chained
requests.exceptions.Timeout instead of matching message text.
Every Solr failure funnels through _raise_search_engine_exception, so
Sentry over-groups them into a single issue (FREESOUND-WEB-3CM). Add a
SearchEngineException taxonomy -- timeout, bad-request (with syntax,
undefined-field and invalid-value subclasses) and internal-error -- and
classify by the HTTP status and reason string in pysolr's message, so
each failure family surfaces as a distinct Sentry issue.

Detect client-side timeouts via the chained requests.exceptions.Timeout
(__cause__) rather than matching "timed out" text; a Solr-side timeout
without a chained cause now surfaces as a generic 5xx internal error.

Also map SearchEngineInternalErrorException (Solr 5xx) to a server error
in the API instead of returning a 400 that blames the client.
@alastair
alastair force-pushed the search-error-split branch from d5da493 to 35930f4 Compare July 21, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant