class Tilia::Dav::Exception::PreconditionFailed

PreconditionFailed

This exception is normally thrown when a client submitted a conditional request, like for example an If, If-None-Match or If-Match header, which caused the HTTP request to not execute (the condition of the header failed)

Attributes

header[RW]

When this exception is thrown, the header-name might be set.

This allows the exception-catching code to determine which HTTP header caused the exception.

@var string

Public Class Methods

new(header = nil) click to toggle source

Create the exception

@param string $message @param string $header

# File lib/tilia/dav/exception/precondition_failed.rb, line 22
def initialize(header = nil)
  self.header = header
end

Public Instance Methods

http_code() click to toggle source

Returns the HTTP statuscode for this exception

@return int

# File lib/tilia/dav/exception/precondition_failed.rb, line 29
def http_code
  412
end
serialize(_server, error_node) click to toggle source

This method allows the exception to include additional information into the WebDAV error response

@param DAVServer server @param DOMElement error_node @return void

# File lib/tilia/dav/exception/precondition_failed.rb, line 38
def serialize(_server, error_node)
  if header
    prop = LibXML::XML::Node.new('s:header', header)
    error_node << prop
  end
end