Exception: Geminize::GeminizeError

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

Overview

Base error class for all Geminize errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, code = nil, http_status = nil) ⇒ GeminizeError

Initialize a new error

Parameters:

  • message (String) (defaults to: nil)

    The error message

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

    The error code from the API response

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

    The HTTP status code



19
20
21
22
23
24
# File 'lib/geminize/errors.rb', line 19

def initialize(message = nil, code = nil, http_status = nil)
  @message = message || "An error occurred with the Geminize API"
  @code = code
  @http_status = http_status
  super(@message)
end

Instance Attribute Details

#codeString? (readonly)

Returns The error code from the API response.

Returns:

  • (String, nil)

    The error code from the API response



10
11
12
# File 'lib/geminize/errors.rb', line 10

def code
  @code
end

#http_statusInteger? (readonly)

Returns The HTTP status code.

Returns:

  • (Integer, nil)

    The HTTP status code



13
14
15
# File 'lib/geminize/errors.rb', line 13

def http_status
  @http_status
end

#messageString (readonly)

Returns The error message.

Returns:

  • (String)

    The error message



7
8
9
# File 'lib/geminize/errors.rb', line 7

def message
  @message
end