Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change opaque ID middleware to not throw OpaqueIDError on 5xx responses #293

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

richa-d
Copy link
Contributor

@richa-d richa-d commented Jan 23, 2024

Currently, if ES returns a 500 response, we get an OpaqueIDError (and not the ServerError) since we only check for an opaque ID mismatch and don't handle the case when opaque ID is nil.
Here I added a check so that the OpaqueIDError will not be thrown if there is a 5xx response from Elasticsearch, and we will get a ElastomerClient::Client::ServerError instead.

@richa-d richa-d self-assigned this Jan 23, 2024
@richa-d richa-d marked this pull request as ready for review January 23, 2024 13:33
kag728
kag728 previously approved these changes Jan 23, 2024
Copy link
Contributor

@kag728 kag728 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this approach!

Copy link
Contributor

@ndonewar ndonewar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the additional tests! 👍

@richa-d richa-d merged commit 652589b into main Jan 24, 2024
3 checks passed
@richa-d richa-d deleted the richa-d/opaqueIDErrorOn5xx branch January 24, 2024 07:19
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.

3 participants