Exception: Doze::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/doze/error.rb

Overview

Doze::Error wraps the data required to send an HTTP error response as an exception which Application and Responder infrastructure can raise.

Direct Known Subclasses

ClientError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_status = Doze::Utils::STATUS_INTERNAL_SERVER_ERROR, message = '', headers = {}, backtrace = nil) ⇒ Error

Returns a new instance of Error.



3
4
5
6
7
8
# File 'lib/doze/error.rb', line 3

def initialize(http_status=Doze::Utils::STATUS_INTERNAL_SERVER_ERROR, message='', headers={}, backtrace=nil)
  @http_status = http_status
  @headers = headers
  @backtrace = backtrace
  super(Rack::Utils::HTTP_STATUS_CODES[http_status] + (message ? ": #{message}" : ''))
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



14
15
16
# File 'lib/doze/error.rb', line 14

def headers
  @headers
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



14
15
16
# File 'lib/doze/error.rb', line 14

def http_status
  @http_status
end

Instance Method Details

#backtraceObject



10
11
12
# File 'lib/doze/error.rb', line 10

def backtrace
  @backtrace || super
end