Split Solr errors into specific exceptions#2169
Open
alastair wants to merge 2 commits into
Open
Conversation
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
force-pushed
the
search-error-split
branch
from
July 21, 2026 09:40
d5da493 to
35930f4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: