Quota Exceded exception

This commit is contained in:
Javier Hernández Gil 2014-04-08 21:02:08 +02:00
parent 661df5ac9e
commit 734e4f61a8
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,11 @@
<?php
namespace Jhg\NexmoBundle\NexmoClient\Exceptions;
/**
* Class QuotaExcededException
* @package Jhg\NexmoBundle\NexmoClient\Exceptions
* @author Javi Hernández <javibilboweb@gmail.com>
*/
class QuotaExcededException extends \Exception {
}

View File

@ -1,6 +1,7 @@
<?php <?php
namespace Jhg\NexmoBundle\NexmoClient; namespace Jhg\NexmoBundle\NexmoClient;
use Jhg\NexmoBundle\NexmoClient\Exceptions\QuotaExcededException;
use Jhg\NexmoBundle\NexmoClient\Exceptions\UnroutableSmsMessageException; use Jhg\NexmoBundle\NexmoClient\Exceptions\UnroutableSmsMessageException;
class NexmoClient { class NexmoClient {
@ -105,8 +106,11 @@ class NexmoClient {
case 6: case 6:
throw new UnroutableSmsMessageException(); throw new UnroutableSmsMessageException();
case 9:
throw new QuotaExcededException();
default: default:
throw new \Exception($response['messages'][0]['error-text']); throw new \Exception($response['messages'][0]['error-text'],(int)$response['messages'][0]['status']);
} }
} }