phpClickHouse icon indicating copy to clipboard operation
phpClickHouse copied to clipboard

check response body to detect error/exception

Open lexand opened this issue 4 years ago • 1 comments

Sometimes ClickHouse returns 200 OK when exception occured

for details see https://github.com/ClickHouse/ClickHouse/issues/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);
    }

lexand avatar Oct 09 '20 09:10 lexand

are there any plans to solve this problem?

lazeevv avatar Jan 22 '21 07:01 lazeevv