Exception: WeInc::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/weinc/client.rb

Overview

Raised for every failed request (non-2xx response, network failure, or invalid input).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Error.



18
19
20
21
22
# File 'lib/weinc/client.rb', line 18

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

Instance Attribute Details

#bodyObject? (readonly)

Returns Parsed response body (Hash/Array if JSON, else raw String).

Returns:

  • (Object, nil)

    Parsed response body (Hash/Array if JSON, else raw String).



15
16
17
18
19
20
21
22
23
# File 'lib/weinc/client.rb', line 15

class Error < StandardError
  attr_reader :status, :body

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

#statusInteger? (readonly)

Returns HTTP status code, if a response was received.

Returns:

  • (Integer, nil)

    HTTP status code, if a response was received.



15
16
17
18
19
20
21
22
23
# File 'lib/weinc/client.rb', line 15

class Error < StandardError
  attr_reader :status, :body

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