Exception: TelphinApi::Error

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

Overview

An exception raised by TelphinApi::Result when given a response with an error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Error

An exception is initialized by the data from response mash.

Parameters:

  • data (Hash)

    Error data.



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

def initialize(data)
  @error_code = data.code
  @error_msg = data.message
end

Instance Attribute Details

#error_codeString (readonly)

An error code.

Returns:

  • (String)


6
7
8
# File 'lib/telphin_api/error.rb', line 6

def error_code
  @error_code
end

Instance Method Details

#messageString

A full description of the error.

Returns:

  • (String)


17
18
19
# File 'lib/telphin_api/error.rb', line 17

def message
  "Telphin returned an error #{@error_code}: '#{@error_msg}'"
end