Exception.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * SabreDAV base exception
  4. *
  5. * This is SabreDAV's base exception file, use this to implement your own exception.
  6. *
  7. * @package Sabre
  8. * @subpackage DAV
  9. * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
  10. * @author Evert Pot (http://www.rooftopsolutions.nl/)
  11. * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
  12. */
  13. /**
  14. * Main Exception class.
  15. *
  16. * This class defines a getHTTPCode method, which should return the appropriate HTTP code for the Exception occurred.
  17. * The default for this is 500.
  18. *
  19. * This class also allows you to generate custom xml data for your exceptions. This will be displayed
  20. * in the 'error' element in the failing response.
  21. */
  22. class Sabre_DAV_Exception extends Exception {
  23. /**
  24. * Returns the HTTP statuscode for this exception
  25. *
  26. * @return int
  27. */
  28. public function getHTTPCode() {
  29. return 500;
  30. }
  31. /**
  32. * This method allows the exception to include additional information into the WebDAV error response
  33. *
  34. * @param Sabre_DAV_Server $server
  35. * @param DOMElement $errorNode
  36. * @return void
  37. */
  38. public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
  39. }
  40. /**
  41. * This method allows the exception to return any extra HTTP response headers.
  42. *
  43. * The headers must be returned as an array.
  44. *
  45. * @param Sabre_DAV_Server $server
  46. * @return array
  47. */
  48. public function getHTTPHeaders(Sabre_DAV_Server $server) {
  49. return array();
  50. }
  51. }