/**
  * @param array $data
  * @param bool $isContacts
  * @throws ActionException
  * @throws ClientException
  * @throws ContactsException
  * @throws HostException
  */
 protected function handleError(array $data, $isContacts)
 {
     if ($isContacts) {
         if ($data['code'] < 200 or $data['code'] > 299) {
             throw new ContactsException($data);
         }
     } else {
         $error = new ErrorResponse($data['output']);
         if ($error->isError()) {
             if (SmsapiException::isHostError($error->code)) {
                 throw new HostException($error->message, $error->code);
             } elseif (SmsapiException::isClientError($error->code)) {
                 throw new ClientException($error->message, $error->code);
             } else {
                 throw new ActionException($error->message, $error->code);
             }
         }
     }
 }
 /**
  * @param $data
  * @throws \SMSApi\Exception\ActionException
  * @throws \SMSApi\Exception\ClientException
  * @throws \SMSApi\Exception\HostException
  */
 protected function handleError($data)
 {
     $error = new \SMSApi\Api\Response\ErrorResponse($data);
     if ($error->isError()) {
         if (\SMSApi\Exception\SmsapiException::isHostError($error->code)) {
             throw new \SMSApi\Exception\HostException($error->message, $error->code);
         }
         if (\SMSApi\Exception\SmsapiException::isClientError($error->code)) {
             throw new \SMSApi\Exception\ClientException($error->message, $error->code);
         } else {
             throw new \SMSApi\Exception\ActionException($error->message, $error->code);
         }
     }
 }