1
0

APIError.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. class ChargeBee_APIError extends Exception {
  3. private $httpStatusCode;
  4. private $jsonObject;
  5. private $type;
  6. private $apiErrorCode;
  7. private $param;
  8. function __construct($httpStatusCode, $jsonObject) {
  9. parent::__construct($jsonObject['message']);
  10. $this->jsonObject = $jsonObject;
  11. $this->type = isset($jsonObject['type'])? $jsonObject['type']:null;
  12. $this->apiErrorCode = $jsonObject['api_error_code'];
  13. $this->param = isset($jsonObject['param'])?$jsonObject['param']:null;
  14. $this->httpStatusCode = $httpStatusCode;
  15. }
  16. public function getHttpStatusCode() {
  17. return $this->httpStatusCode;
  18. }
  19. public function getType() {
  20. return $this->type;
  21. }
  22. public function getApiErrorCode() {
  23. return $this->apiErrorCode;
  24. }
  25. public function getParam() {
  26. return $this->param;
  27. }
  28. /**
  29. * This function has been deprecated. Use getHttpStatusCode.
  30. * @deprecated
  31. */
  32. public function getHttpCode() {
  33. return $this->httpStatusCode;
  34. }
  35. /**
  36. * This function has been deprecated. There IO errors are now thrown as
  37. * ChargeBee_IOException.
  38. * @deprecated
  39. */
  40. public function getErrorNo() {
  41. return 0;
  42. }
  43. public function getJsonObject() {
  44. return $this->jsonObject;
  45. }
  46. }
  47. ?>