Simplify_ApiException

Base class for all API exceptions.

Defined (1)

The class is defined in the following location(s).

/includes/gateways/simplify-commerce/includes/Simplify/Exceptions.php  
  1. class Simplify_ApiException extends Exception 
  2.  
  3. protected $errorData; 
  4. protected $status; 
  5. protected $errorCode; 
  6. protected $reference; 
  7.  
  8. /** 
  9. * @ignore 
  10. */ 
  11. function __construct($message, $status = null, $errorData = null) { 
  12. parent::__construct($message); 
  13.  
  14. $this->status = $status; 
  15. $this->errorCode = null; 
  16. $this->reference = null; 
  17.  
  18. if ($errorData != null) { 
  19.  
  20. $this->reference = $errorData['reference']; 
  21. $this->errorData = $errorData; 
  22.  
  23. $error = $errorData['error']; 
  24. if ($error != null) { 
  25.  
  26. $m = $error['message']; 
  27. if ($m != null) { 
  28. $this->message = $m; 
  29.  
  30. $this->errorCode = $error['code']; 
  31.  
  32. /** 
  33. * Returns a map of all error data returned by the API. 
  34. * @return array a map containing API error data. 
  35. */ 
  36. function getErrorData() { 
  37. return $this->errorData; 
  38.  
  39. /** 
  40. * Returns the HTTP status for the request. 
  41. * @return string HTTP status code (or null if there is no status). 
  42. */ 
  43. function getStatus() { 
  44. return $this->status; 
  45.  
  46. /** 
  47. * Returns unique reference for the API error. 
  48. * @return string a reference (or null if there is no reference). 
  49. */ 
  50. function getReference() { 
  51. return $this->reference; 
  52.  
  53. /** 
  54. * Returns an code for the API error. 
  55. * @return string the error code. 
  56. */ 
  57. function getErrorCode() { 
  58. return $this->errorCode; 
  59.  
  60. /** 
  61. * Returns a description of the error. 
  62. * @return string Description of the error. 
  63. */ 
  64. function describe() { 
  65. return get_class($this) . ": \"" 
  66. . $this->getMessage() . "\" (status: " 
  67. . $this->getStatus() . ", error code: " 
  68. . $this->getErrorCode() . ", reference: " 
  69. . $this->getReference() . ")"; 
  70.