6 * This exception is normally thrown when a client submitted a conditional request,
7 * like for example an If, If-None-Match or If-Match header, which caused the HTTP
8 * request to not execute (the condition of the header failed)
12 * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
13 * @author Evert Pot (http://www.rooftopsolutions.nl/)
14 * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
16 class Sabre_DAV_Exception_PreconditionFailed extends Sabre_DAV_Exception {
19 * When this exception is thrown, the header-name might be set.
21 * This allows the exception-catching code to determine which HTTP header
22 * caused the exception.
26 public $header = null;
29 * Create the exception
31 * @param string $message
32 * @param string $header
34 public function __construct($message, $header=null) {
36 parent::__construct($message);
37 $this->header = $header;
42 * Returns the HTTP statuscode for this exception
46 public function getHTTPCode() {
53 * This method allows the exception to include additional information into the WebDAV error response
55 * @param Sabre_DAV_Server $server
56 * @param DOMElement $errorNode
59 public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
62 $prop = $errorNode->ownerDocument->createElement('s:header');
63 $prop->nodeValue = $this->header;
64 $errorNode->appendChild($prop);