Exception.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. declare(strict_types=1);
  3. namespace Sabre\DAV;
  4. /**
  5. * Main Exception class.
  6. *
  7. * This class defines a getHTTPCode method, which should return the appropriate HTTP code for the Exception occurred.
  8. * The default for this is 500.
  9. *
  10. * This class also allows you to generate custom xml data for your exceptions. This will be displayed
  11. * in the 'error' element in the failing response.
  12. *
  13. * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
  14. * @author Evert Pot (http://evertpot.com/)
  15. * @license http://sabre.io/license/ Modified BSD License
  16. */
  17. class Exception extends \Exception
  18. {
  19. /**
  20. * Returns the HTTP statuscode for this exception.
  21. *
  22. * @return int
  23. */
  24. public function getHTTPCode()
  25. {
  26. return 500;
  27. }
  28. /**
  29. * This method allows the exception to include additional information into the WebDAV error response.
  30. */
  31. public function serialize(Server $server, \DOMElement $errorNode)
  32. {
  33. }
  34. /**
  35. * This method allows the exception to return any extra HTTP response headers.
  36. *
  37. * The headers must be returned as an array.
  38. *
  39. * @return array
  40. */
  41. public function getHTTPHeaders(Server $server)
  42. {
  43. return [];
  44. }
  45. }