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

Put RaiseError middleware at the end of the middleware chain #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

madejejej
Copy link
Contributor

@madejejej madejejej commented Sep 8, 2023

Faraday middlewares are being called in reverse order.

With the current ordering, you might get a successful (200) response from Clickhouse with an expected content type (application/json), but the response body might contain an error message. This will cause ClickHouse to raise a JSON::ParserError or Oj::ParserError instead of a DbException.

We need to reverse the middleware order to check the response status first and only then attempt to parse the body.

@madejejej madejejej changed the title Put parser middlewares in the beginning of the middleware chain Put RaiseError middleware at the end of the middleware chain Sep 8, 2023
@serg-kovalev
Copy link

@shlima can you please take a look on this?

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.

2 participants