Exception: Elementary::Errors::RPCFailure

Inherits:
StandardError
  • Object
show all
Defined in:
lib/elementary/errors.rb

Overview

A simple root class to signify an failure on the RPC server side (see

"rpc_failed 'message'")

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ RPCFailure

Returns a new instance of RPCFailure.



8
9
10
11
12
13
14
15
# File 'lib/elementary/errors.rb', line 8

def initialize(opts = {})
  @status_code = opts.fetch(:status_code, nil)
  @method = opts.fetch(:method, "<Unknown Method>")
  @url = opts.fetch(:url, "<Unknown URL>")
  @header_code = opts.fetch(:header_code, "<Unknown Header Code>")
  @header_message = opts.fetch(:header_message, "<Unknown Header Message>")
  super "Error #{@header_code}: #{@header_message}"
end

Instance Attribute Details

#header_codeObject (readonly)

Returns the value of attribute header_code.



6
7
8
# File 'lib/elementary/errors.rb', line 6

def header_code
  @header_code
end

#header_messageObject (readonly)

Returns the value of attribute header_message.



6
7
8
# File 'lib/elementary/errors.rb', line 6

def header_message
  @header_message
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/elementary/errors.rb', line 6

def method
  @method
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



6
7
8
# File 'lib/elementary/errors.rb', line 6

def status_code
  @status_code
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/elementary/errors.rb', line 6

def url
  @url
end