Exception: Peatio::Error

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

Direct Known Subclasses

Auth::Error

Constant Summary collapse

@@default_code =
2000

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Error

Returns a new instance of Error.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/peatio/error.rb', line 6

def initialize(opts = {})
  @code = opts[:code] || @@default_code
  @text = opts[:text] || ""

  @message = {error: {code: @code, message: @text}}

  if @text != ""
    super("#{@code}: #{text}")
  else
    super("#{@code}")
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/peatio/error.rb', line 4

def code
  @code
end