protected function checkStatusCode($status_code)
{
$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
switch ($status_code) {
case 200:
case 201:
break;
case 204:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));
break;
case 400:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));
break;
case 401:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));
break;
case 404:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));
break;
case 405:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));
break;
case 500:
throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));
break;
default:
throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code);
}
}