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