RestException.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * An exception talking to the Twilio API. This is thrown whenever the Twilio
  4. * API returns a 400 or 500-level exception.
  5. *
  6. * :param int $status: the HTTP status for the exception
  7. * :param string $message: a human-readable error message for the exception
  8. * :param int $code: a Twilio-specific error code for the exception
  9. * :param string $info: a link to more information
  10. */
  11. class Services_Twilio_RestException extends Exception {
  12. /**
  13. * The HTTP status for the exception.
  14. */
  15. protected $status;
  16. /**
  17. * A URL to get more information about the error. This is not always
  18. * available
  19. */
  20. protected $info;
  21. public function __construct($status, $message, $code = 0, $info = '') {
  22. $this->status = $status;
  23. $this->info = $info;
  24. parent::__construct($message, $code);
  25. }
  26. /**
  27. * Get the HTTP status code
  28. */
  29. public function getStatus() {
  30. return $this->status;
  31. }
  32. /**
  33. * Get a link to more information
  34. */
  35. public function getInfo() {
  36. return $this->info;
  37. }
  38. }