Exception: JsonRpcErrors::BaseError
- Inherits:
-
StandardError
- Object
- StandardError
- JsonRpcErrors::BaseError
- Defined in:
- lib/jsonrpc2.0/Errors.rb
Direct Known Subclasses
Constant Summary collapse
- CODE =
nil
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(message = "", data = nil) ⇒ BaseError
constructor
A new instance of BaseError.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(message = "", data = nil) ⇒ BaseError
Returns a new instance of BaseError.
16 17 18 19 |
# File 'lib/jsonrpc2.0/Errors.rb', line 16 def initialize( = "", data = nil) super @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/jsonrpc2.0/Errors.rb', line 10 def data @data end |
Instance Method Details
#code ⇒ Object
12 13 14 |
# File 'lib/jsonrpc2.0/Errors.rb', line 12 def code self.class::CODE end |
#to_json(*a) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/jsonrpc2.0/Errors.rb', line 21 def to_json(*a) error = {} error['code'] = code error['message'] = error['data'] = data if !(data == nil) error.to_json(*a) end |