public static function Braintree_Util::throwStatusCodeException in Commerce Braintree 7
throws an exception based on the type of error
Parameters
string $statusCode HTTP status code to throw exception from:
Throws
Braintree_Exception multiple types depending on the error
12 calls to Braintree_Util::throwStatusCodeException()
- Braintree_Http::delete in braintree_php/
lib/ Braintree/ Http.php - Braintree_Http::get in braintree_php/
lib/ Braintree/ Http.php - Braintree_Http::post in braintree_php/
lib/ Braintree/ Http.php - Braintree_Http::put in braintree_php/
lib/ Braintree/ Http.php - Braintree_TransparentRedirect::parseAndValidateQueryString in braintree_php/
lib/ Braintree/ TransparentRedirect.php
File
- braintree_php/
lib/ Braintree/ Util.php, line 55
Class
- Braintree_Util
- Braintree Utility methods
Code
public static function throwStatusCodeException($statusCode, $message = null) {
switch ($statusCode) {
case 401:
throw new Braintree_Exception_Authentication();
break;
case 403:
throw new Braintree_Exception_Authorization($message);
break;
case 404:
throw new Braintree_Exception_NotFound();
break;
case 426:
throw new Braintree_Exception_UpgradeRequired();
break;
case 500:
throw new Braintree_Exception_ServerError();
break;
case 503:
throw new Braintree_Exception_DownForMaintenance();
break;
default:
throw new Braintree_Exception_Unexpected('Unexpected HTTP_RESPONSE #' . $statusCode);
break;
}
}