|
@@ 83-100 (lines=18) @@
|
| 80 |
|
* |
| 81 |
|
* @return \Fresh\SinchBundle\Exception\SinchException|null |
| 82 |
|
*/ |
| 83 |
|
private static function getSinchExceptionForBadRequest($errorCode, $errorMessage) |
| 84 |
|
{ |
| 85 |
|
$exception = null; |
| 86 |
|
|
| 87 |
|
switch ($errorCode) { |
| 88 |
|
case SinchErrorCode::PARAMETER_VALIDATION: |
| 89 |
|
$exception = new SinchParameterValidationException($errorMessage); |
| 90 |
|
break; |
| 91 |
|
case SinchErrorCode::MISSING_PARAMETER: |
| 92 |
|
$exception = new SinchMissingParameterException($errorMessage); |
| 93 |
|
break; |
| 94 |
|
case SinchErrorCode::INVALID_REQUEST: |
| 95 |
|
$exception = new SinchInvalidRequestException($errorMessage); |
| 96 |
|
break; |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
return $exception; |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
/** |
| 103 |
|
* Get Sinch exception for unauthorized |
|
@@ 150-168 (lines=19) @@
|
| 147 |
|
* |
| 148 |
|
* @return \Fresh\SinchBundle\Exception\SinchException|null |
| 149 |
|
*/ |
| 150 |
|
private static function getSinchExceptionForForbidden($errorCode, $errorMessage) |
| 151 |
|
{ |
| 152 |
|
$exception = null; |
| 153 |
|
|
| 154 |
|
switch ($errorCode) { |
| 155 |
|
case SinchErrorCode::FORBIDDEN_REQUEST: |
| 156 |
|
$exception = new SinchForbiddenRequestException($errorMessage); |
| 157 |
|
break; |
| 158 |
|
case SinchErrorCode::INVALID_AUTHORIZATION_SCHEME_FOR_CALLING_THE_METHOD: |
| 159 |
|
$exception = new SinchInvalidAuthorizationSchemeException($errorMessage); |
| 160 |
|
break; |
| 161 |
|
case SinchErrorCode::NO_VERIFIED_PHONE_NUMBER_ON_YOUR_SINCH_ACCOUNT: |
| 162 |
|
case SinchErrorCode::SANDBOX_SMS_ONLY_ALLOWED_TO_BE_SENT_TO_VERIFIED_NUMBERS: |
| 163 |
|
$exception = new SinchNoVerifiedPhoneNumberException($errorMessage); |
| 164 |
|
break; |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
return $exception; |
| 168 |
|
} |
| 169 |
|
|
| 170 |
|
/** |
| 171 |
|
* Get Sinch exception for internal server error |