getStatus() / 100); if ($mainCode === 2) { return $res; } if ($this->allow404 && $res->getStatus() == 404) { return $res; } $js = json_decode($res->getBody()); if (isset($js->error)) { $error = $js->error; } else { $error = $res->getBody(); } throw new Exception( 'Error in elasticsearch communication' . '(status code ' . $res->getStatus() . '): ' . $error ); } } ?>