Google_ServiceException

The Google Adsense Dashboard Google Service Exception class.

Defined (1)

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

/src/Google/Service/Exception.php  
  1. class Google_Service_Exception extends Google_Exception 
  2. /** 
  3. * Optional list of errors returned in a JSON body of an HTTP error response. 
  4. */ 
  5. protected $errors = array(); 
  6.  
  7. /** 
  8. * Override default constructor to add ability to set $errors. 
  9. * @param string $message 
  10. * @param int $code 
  11. * @param Exception|null $previous 
  12. * @param [{string, string}] errors List of errors returned in an HTTP 
  13. * response. Defaults to []. 
  14. */ 
  15. public function __construct( 
  16. $message,  
  17. $code = 0,  
  18. Exception $previous = null,  
  19. $errors = array() 
  20. ) { 
  21. if (version_compare(PHP_VERSION, '5.3.0') >= 0) { 
  22. parent::__construct($message, $code, $previous); 
  23. } else { 
  24. parent::__construct($message, $code); 
  25.  
  26. $this->errors = $errors; 
  27.  
  28. /** 
  29. * An example of the possible errors returned. 
  30. * { 
  31. * "domain": "global",  
  32. * "reason": "authError",  
  33. * "message": "Invalid Credentials",  
  34. * "locationType": "header",  
  35. * "location": "Authorization",  
  36. * } 
  37. * @return [{string, string}] List of errors return in an HTTP response or []. 
  38. */ 
  39. public function getErrors() 
  40. return $this->errors;