Sha256: c1951bd8e63bb02473f184fa9b1c6965b5390e1b1b6c5cf5655118c67163f433

Contents?: true

Size: 567 Bytes

Versions: 5

Compression:

Stored size: 567 Bytes

Contents

module TelphinApi
  # An exception raised by `TelphinApi::Result` when given a response with an error.
  class Error < StandardError
    # An error code.
    # @return [String]
    attr_reader :error_code

    # An exception is initialized by the data from response mash.
    # @param [Hash] data Error data.
    def initialize(data)
      @error_code = data.code
      @error_msg = data.message
    end

    # A full description of the error.
    # @return [String]
    def message
      "Telphin returned an error #{@error_code}: '#{@error_msg}'"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
telphin_api-1.0.4 lib/telphin_api/error.rb
telphin_api-1.0.3 lib/telphin_api/error.rb
telphin_api-1.0.2 lib/telphin_api/error.rb
telphin_api-1.0.1 lib/telphin_api/error.rb
telphin_api-1.0.0 lib/telphin_api/error.rb