Exception: Spice::Error

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

Defined Under Namespace

Classes: BadRequest, ClientError, Conflict, Forbidden, NotAcceptable, NotFound, Unauthorized

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception = $!, http_headers = {}) ⇒ Error

Returns a new instance of Error.


5
6
7
8
9
10
11
12
13
# File 'lib/spice/error.rb', line 5

def initialize(exception=$!, http_headers={})
  @http_headers = http_headers
  if exception.respond_to?(:backtrace)
    super(exception.message)
    @wrapped_exception = exception
  else
    super(exception.to_s)
  end
end

Instance Attribute Details

#http_headersObject (readonly)

Returns the value of attribute http_headers


3
4
5
# File 'lib/spice/error.rb', line 3

def http_headers
  @http_headers
end

#wrapped_exceptionObject (readonly)

Returns the value of attribute wrapped_exception


3
4
5
# File 'lib/spice/error.rb', line 3

def wrapped_exception
  @wrapped_exception
end

Instance Method Details

#backtraceObject


15
16
17
# File 'lib/spice/error.rb', line 15

def backtrace
  @wrapped_exception ? @wrapped_exception.backtrace : super
end