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

check response body to detect error/exception #144

Open
lexand opened this issue Oct 9, 2020 · 1 comment
Open

check response body to detect error/exception #144

lexand opened this issue Oct 9, 2020 · 1 comment

Comments

@lexand
Copy link

lexand commented Oct 9, 2020

Sometimes ClickHouse returns 200 OK when exception occured

for details see ClickHouse/ClickHouse#15124

currently \ClickHouseDB\Statement

<?php
    /**
     * @return bool
     * @throws Exception\TransportException
     */
    public function isError()
    {
        return ($this->response()->http_code() !== 200 || $this->response()->error_no());
    }

suggest to check response body too

<?php
    /**
     * @return bool
     * @throws Exception\TransportException
     */
    public function isError()
    {
        return ($this->response()->http_code() !== 200)
               || $this->response()->error_no()
               || (\stripos($this->response()->body(), 'DB::Exception') !== false);
    }
@lazeevv
Copy link

lazeevv commented Jan 22, 2021

are there any plans to solve this problem?

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

No branches or pull requests

2 participants