Exception: SynsbasenApi::Error

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

Overview

The Error module provides custom error classes for handling API errors.

Direct Known Subclasses

ClientError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = '', status = '', data = {}) ⇒ Error

Initializes a new instance of Error.

Parameters:

  • msg (String) (defaults to: '') —

    The error message.

  • status (String) (defaults to: '') —

    The HTTP status code associated with the error.

  • data (Hash) (defaults to: {}) —

    Additional data associated with the error.



20
21
22
23
24
# File 'lib/synsbasen_api/error.rb', line 20

def initialize(msg = '', status = '', data = {})
  @message = msg
  @status = status
  @data = data
end

Instance Attribute Details

#data ⇒ Hash

Returns Additional data associated with the error.

Returns:

  • (Hash) —

    Additional data associated with the error.



13
14
15
# File 'lib/synsbasen_api/error.rb', line 13

def data
  @data
end

#message ⇒ String

Returns The error message.

Returns:

  • (String) —

    The error message.



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

def message
  @message
end

#status ⇒ String

Returns The HTTP status code associated with the error.

Returns:

  • (String) —

    The HTTP status code associated with the error.



10
11
12
# File 'lib/synsbasen_api/error.rb', line 10

def status
  @status
end