Exception: Peatio::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Peatio::Error
- Defined in:
- lib/peatio/error.rb
Direct Known Subclasses
Constant Summary collapse
- @@default_code =
2000
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Error
constructor
A new instance of Error.
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] || "" = {error: {code: @code, message: @text}} if @text != "" super("#{@code}: #{text}") else super("#{@code}") end end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/peatio/error.rb', line 4 def code @code end |