Exception: Passage::PassageError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, status_code: nil, body: nil) ⇒ PassageError

Returns a new instance of PassageError.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/passageidentity/error.rb', line 10

def initialize(message:, status_code: nil, body: nil)
  @message = message
  @status_code = status_code
  @status_text =
    (
      if status_code.nil?
        nil
      else
        Net::HTTPResponse::CODE_TO_OBJ[status_code.to_s]
      end
    )
  @error = body.nil? ? nil : body["error"]
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



8
9
10
# File 'lib/passageidentity/error.rb', line 8

def error
  @error
end

#messageObject (readonly)

Returns the value of attribute message.



7
8
9
# File 'lib/passageidentity/error.rb', line 7

def message
  @message
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



5
6
7
# File 'lib/passageidentity/error.rb', line 5

def status_code
  @status_code
end

#status_textObject (readonly)

Returns the value of attribute status_text.



6
7
8
# File 'lib/passageidentity/error.rb', line 6

def status_text
  @status_text
end