Example #1
0
 /**
  * Handle SQS exceptions
  *
  * @throws Exception in case the queue doesn't exist
  * @see http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/Query_QueryErrors.html
  * @param Exception $e
  * @return false
  */
 protected function _handleException(Exception $e)
 {
     $fatalErrors = array('AccessDenied', 'AuthFailure', 'InvalidAccessKeyId', 'InvalidAction', 'InvalidAddress', 'InvalidHttpRequest', 'InvalidRequest', 'InvalidSecurity', 'InvalidSecurityToken', 'InvalidClientTokenId', 'MissingClientTokenId', 'MissingCredentials', 'MissingParameter', 'X509ParseError', 'AWS.SimpleQueueService.NonExistentQueue');
     if ($this->_exceptionCount >= 25) {
         throw $e;
     }
     if ($e instanceof Aws\Common\Exception\ServiceResponseException) {
         if (in_array($e->getExceptionCode(), $fatalErrors)) {
             throw $e;
         }
     }
     $this->_exceptionCount++;
     CakeLog::error($e->getMessage(), 'sqs');
     return false;
 }