Exception: Apress::YandexMarket::Api::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, code = nil) ⇒ Error

Returns a new instance of Error.

Raises:



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

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

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

  raise PageError.new(message) if msg.start_with? Api::PageError::MSG

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/apress/yandex_market/api/error.rb', line 5

def code
  @code
end