/wp-includes/Requests/Exception.php

  1. <?php 
  2. /** 
  3. * Exception for HTTP requests 
  4. * 
  5. * @package Requests 
  6. */ 
  7.  
  8. /** 
  9. * Exception for HTTP requests 
  10. * 
  11. * @package Requests 
  12. */ 
  13. class Requests_Exception extends Exception { 
  14. /** 
  15. * Type of exception 
  16. * 
  17. * @var string 
  18. */ 
  19. protected $type; 
  20.  
  21. /** 
  22. * Data associated with the exception 
  23. * 
  24. * @var mixed 
  25. */ 
  26. protected $data; 
  27.  
  28. /** 
  29. * Create a new exception 
  30. * 
  31. * @param string $message Exception message 
  32. * @param string $type Exception type 
  33. * @param mixed $data Associated data 
  34. * @param integer $code Exception numerical code, if applicable 
  35. */ 
  36. public function __construct($message, $type, $data = null, $code = 0) { 
  37. parent::__construct($message, $code); 
  38.  
  39. $this->type = $type; 
  40. $this->data = $data; 
  41.  
  42. /** 
  43. * Like {@see getCode()}, but a string code. 
  44. * 
  45. * @codeCoverageIgnore 
  46. * @return string 
  47. */ 
  48. public function getType() { 
  49. return $this->type; 
  50.  
  51. /** 
  52. * Gives any relevant data 
  53. * 
  54. * @codeCoverageIgnore 
  55. * @return mixed 
  56. */ 
  57. public function getData() { 
  58. return $this->data; 
.