From 43c0c514d3881fdf006c493154b03f3c53742d75 Mon Sep 17 00:00:00 2001 From: risou Date: Sun, 11 May 2014 23:49:57 +0900 Subject: [PATCH] check Exception class in method _handleException Add checking the exception that belongs to ServiceResponseException. For example, exception is instance of ValidateException, it has no method "getExceptionCode()". In this case, "$e->getExceptionCode()" causes PHP Fatal Error. --- Model/SimpleQueue.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Model/SimpleQueue.php b/Model/SimpleQueue.php index 3ef5e23..6e48777 100644 --- a/Model/SimpleQueue.php +++ b/Model/SimpleQueue.php @@ -205,10 +205,16 @@ protected function _handleException(Exception $e) { 'AWS.SimpleQueueService.NonExistentQueue' ); - if (in_array($e->getExceptionCode(), $fatalErrors) || $this->_exceptionCount >= 25) { + 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;