diff --git a/src/Plivo/Exceptions/PlivoResponseException.php b/src/Plivo/Exceptions/PlivoResponseException.php index 42b1e32c..488cf0f2 100644 --- a/src/Plivo/Exceptions/PlivoResponseException.php +++ b/src/Plivo/Exceptions/PlivoResponseException.php @@ -58,7 +58,7 @@ public function getErrorMessage() /** * Returns an exceptions with a message based on the status code * @param string $message - * @return PlivoAuthenticationException|PlivoNotFoundException|PlivoRequestException|PlivoRestException|PlivoServerException|PlivoValidationException + * @return PlivoAuthenticationException|PlivoNotFoundException|PlivoRequestException|PlivoRestException|PlivoServerException|PlivoValidationException|PlivoTooManyRequestsException */ public function getException($message) { @@ -93,6 +93,13 @@ public function getException($message) new PlivoRequestException( "HTTP method used is not allowed to access resource"); break; + case 429: + return + $message? + new PlivoTooManyRequestsException($message): + new PlivoTooManyRequestsException( + "Too many requests"); + break; case 500: return $message? diff --git a/src/Plivo/Exceptions/PlivoTooManyRequestsException.php b/src/Plivo/Exceptions/PlivoTooManyRequestsException.php new file mode 100644 index 00000000..98c20f2a --- /dev/null +++ b/src/Plivo/Exceptions/PlivoTooManyRequestsException.php @@ -0,0 +1,14 @@ +