Simplify_BadRequestException

Exception raised when the API request contains errors.

Defined (1)

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

/includes/gateways/simplify-commerce/includes/Simplify/Exceptions.php  
  1. class Simplify_BadRequestException extends Simplify_ApiException { 
  2.  
  3. protected $fieldErrors; 
  4.  
  5. /** 
  6. * @ignore 
  7. */ 
  8. function __construct($message, $status = null, $errorData = null) { 
  9. parent::__construct($message, $status, $errorData); 
  10.  
  11. $fieldErrors = array(); 
  12.  
  13. if ($errorData != null) { 
  14. $error = $errorData['error']; 
  15. if ($error != null) { 
  16. $fieldErrors = $error['fieldErrors']; 
  17. if ($fieldErrors != null) { 
  18. $this->fieldErrors = array(); 
  19. foreach ($fieldErrors as $fieldError) { 
  20. array_push($this->fieldErrors, new Simplify_FieldError($fieldError)); 
  21.  
  22. /** 
  23. * Returns a boolean indicating whether there are any field errors. 
  24. * @return boolean true if there are field errors; false otherwise. 
  25. */ 
  26. function hasFieldErrors() { 
  27. return count($this->fieldErrors) > 0; 
  28.  
  29. /** 
  30. * Returns a list containing all field errors. 
  31. * @return array list of field errors. 
  32. */ 
  33. function getFieldErrors() { 
  34. return $this->fieldErrors; 
  35.  
  36. /** 
  37. * Returns a description of the error. 
  38. * @return string description of the error. 
  39. */ 
  40. function describe() { 
  41. $s = parent::describe(); 
  42. foreach ($this->getFieldErrors() as $fieldError) { 
  43. $s = $s . "\n" . (string) $fieldError; 
  44. return $s . "\n"; 
  45.