Exception: Hanko::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/hanko/errors.rb

Overview

Raised when the Hanko API returns an HTTP 4xx or 5xx response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, status: nil, body: nil) ⇒ ApiError

Returns a new instance of ApiError.

Parameters:

  • message (String, nil) (defaults to: nil)

    the error message

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

    the HTTP status code

  • body (Hash, nil) (defaults to: nil)

    the parsed response body



33
34
35
36
37
# File 'lib/hanko/errors.rb', line 33

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

Instance Attribute Details

#bodyHash? (readonly)

Returns the parsed response body.

Returns:

  • (Hash, nil)

    the parsed response body



28
29
30
# File 'lib/hanko/errors.rb', line 28

def body
  @body
end

#statusInteger? (readonly)

Returns the HTTP status code.

Returns:

  • (Integer, nil)

    the HTTP status code



25
26
27
# File 'lib/hanko/errors.rb', line 25

def status
  @status
end