Exception: Apress::Moysklad::Api::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/apress/moysklad/api/error.rb

Overview

Ошибка при взаимодействии с API МойСклад

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, code = nil) ⇒ Error

Returns a new instance of Error.



8
9
10
11
12
13
14
# File 'lib/apress/moysklad/api/error.rb', line 8

def initialize(msg, code = nil)
  @code = code.to_i

  message = code ? "#{code} - #{msg}" : msg

  super message.force_encoding('UTF-8')
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/apress/moysklad/api/error.rb', line 6

def code
  @code
end