Exception: ReactorSDK::Error

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

Overview

Base class for all ReactorSDK errors. Every other error in this file inherits from this class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status: nil, cause: nil) ⇒ Error

Returns a new instance of Error.

Parameters:

  • message (String)

    Human-readable description of what went wrong

  • status (Integer, nil) (defaults to: nil)

    HTTP status code from the API response

  • cause (Exception, nil) (defaults to: nil)

    Underlying exception if this wraps another error



38
39
40
41
42
# File 'lib/reactor_sdk/error.rb', line 38

def initialize(message, status: nil, cause: nil)
  super(message)
  @status = status
  @cause  = cause
end

Instance Attribute Details

#causeException? (readonly)

Returns The original exception that caused this one.

Returns:

  • (Exception, nil)

    The original exception that caused this one



31
32
33
# File 'lib/reactor_sdk/error.rb', line 31

def cause
  @cause
end

#statusInteger? (readonly)

Returns HTTP status code from the API response.

Returns:

  • (Integer, nil)

    HTTP status code from the API response



28
29
30
# File 'lib/reactor_sdk/error.rb', line 28

def status
  @status
end