|
@@ 323-340 (lines=18) @@
|
| 320 |
|
* |
| 321 |
|
* @return \Fresh\SinchBundle\Exception\SinchException|null |
| 322 |
|
*/ |
| 323 |
|
private function getSinchExceptionForBadRequest($errorCode, $errorMessage) |
| 324 |
|
{ |
| 325 |
|
$exception = null; |
| 326 |
|
|
| 327 |
|
switch ($errorCode) { |
| 328 |
|
case SinchErrorCode::PARAMETER_VALIDATION: |
| 329 |
|
$exception = new SinchParameterValidationException($errorMessage); |
| 330 |
|
break; |
| 331 |
|
case SinchErrorCode::MISSING_PARAMETER: |
| 332 |
|
$exception = new SinchMissingParameterException($errorMessage); |
| 333 |
|
break; |
| 334 |
|
case SinchErrorCode::INVALID_REQUEST: |
| 335 |
|
$exception = new SinchInvalidRequestException($errorMessage); |
| 336 |
|
break; |
| 337 |
|
} |
| 338 |
|
|
| 339 |
|
return $exception; |
| 340 |
|
} |
| 341 |
|
|
| 342 |
|
/** |
| 343 |
|
* Get Sinch exception for unauthorized |
|
@@ 390-408 (lines=19) @@
|
| 387 |
|
* |
| 388 |
|
* @return \Fresh\SinchBundle\Exception\SinchException|null |
| 389 |
|
*/ |
| 390 |
|
private function getSinchExceptionForForbidden($errorCode, $errorMessage) |
| 391 |
|
{ |
| 392 |
|
$exception = null; |
| 393 |
|
|
| 394 |
|
switch ($errorCode) { |
| 395 |
|
case SinchErrorCode::FORBIDDEN_REQUEST: |
| 396 |
|
$exception = new SinchForbiddenRequestException($errorMessage); |
| 397 |
|
break; |
| 398 |
|
case SinchErrorCode::INVALID_AUTHORIZATION_SCHEME_FOR_CALLING_THE_METHOD: |
| 399 |
|
$exception = new SinchInvalidAuthorizationSchemeException($errorMessage); |
| 400 |
|
break; |
| 401 |
|
case SinchErrorCode::NO_VERIFIED_PHONE_NUMBER_ON_YOUR_SINCH_ACCOUNT: |
| 402 |
|
case SinchErrorCode::SANDBOX_SMS_ONLY_ALLOWED_TO_BE_SENT_TO_VERIFIED_NUMBERS: |
| 403 |
|
$exception = new SinchNoVerifiedPhoneNumberException($errorMessage); |
| 404 |
|
break; |
| 405 |
|
} |
| 406 |
|
|
| 407 |
|
return $exception; |
| 408 |
|
} |
| 409 |
|
|
| 410 |
|
/** |
| 411 |
|
* Get Sinch exception for internal server error |