Exception: KazeClient::Error::Generic

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/kaze_client/error/generic.rb

Overview

Generic error raised when Kaze server send an unknown error. By default, it is considered to be an internal server error.

Author:

Since:

  • 0.1.0

Constant Summary collapse

DEFAULT_MESSAGE =

The default error message

Since:

  • 0.1.0

'An unknown error occured'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status: :internal_server_error, error: nil, message: DEFAULT_MESSAGE) ⇒ Generic

Returns a new instance of Generic.

Since:

  • 0.1.0



23
24
25
26
27
28
29
# File 'lib/kaze_client/error/generic.rb', line 23

def initialize(status: :internal_server_error, error: nil,
               message: DEFAULT_MESSAGE)
  super(message || DEFAULT_MESSAGE)

  @status = status || :internal_server_error
  @error  = error || @status
end

Instance Attribute Details

#errorString, Symbol (readonly)

Returns:

  • (String)

    if the server sent a custom error code

  • (Symbol)

    if the server sent no code, it is the HTTP status sent by the server

Since:

  • 0.1.0



18
19
20
# File 'lib/kaze_client/error/generic.rb', line 18

def error
  @error
end

#statusSymbol (readonly)

Returns The HTTP status sent by the server.

Returns:

  • (Symbol)

    The HTTP status sent by the server

Since:

  • 0.1.0



14
15
16
# File 'lib/kaze_client/error/generic.rb', line 14

def status
  @status
end