Пример #1
0
 /**
  * @throws HttpException
  */
 protected function handleError()
 {
     $body = (string) $this->response->getBody();
     $code = (int) $this->response->getStatusCode();
     $content = json_decode($body);
     throw new HttpException(isset($content->message) ? $content->message : 'Request not processed.', $code);
 }
Пример #2
0
 /**
  * @throws HttpException
  */
 protected function handleError()
 {
     $body = (string) $this->response->getBody();
     $code = (int) $this->response->getStatusCode();
     $content = json_decode($body);
     $error = $content->errors[0];
     throw new HttpException(isset($error) ? $error->description : 'Request not processed.', $code);
 }