Add try/catch around cql call#758
Merged
Merged
Conversation
charmingduchess
requested changes
Jun 8, 2026
| const query = (cqlQuery || new CqlQuery(params.q)).buildEsQuery(request) | ||
| return query | ||
| } catch (e) { | ||
| throw new InvalidQuerySyntaxError(e.message) |
Contributor
There was a problem hiding this comment.
This should probably be a logger.warn, or else it will continue to trigger alarms.
Contributor
Author
There was a problem hiding this comment.
This error is caught higher up and converted to a 422 response. Running it locally I don't see any errors in the logs
Contributor
|
for posterity, this is the ticket cut for this alarm |
nonword
approved these changes
Jun 9, 2026
charmingduchess
approved these changes
Jun 10, 2026
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.
Addresses an error found in today's alarms: when a patron searches for an invalid CQL query, the RC searches both /resources and /resources/aggregations. We are correctly responding with a 422 for the first path, but the second path responds with a 500 error that is invisible to the patron but clutters our logs.
This PR adds a try/catch block around the parsing so that we can respond with a 422 in this case and not log an error.
Future work in RC may investigate whether it is possible to avoid this call altogether.