Class: JsonRpcObjects::V20::Error
- Inherits:
-
JsonRpcObjects::V11::Alt::Error
- Object
- Generic::Object
- Generic::Error
- JsonRpcObjects::V10::Error
- JsonRpcObjects::V11::WD::Error
- JsonRpcObjects::V11::Alt::Error
- JsonRpcObjects::V20::Error
- Defined in:
- lib/json-rpc-objects/v20/error.rb
Overview
Error description object class for Response.
Constant Summary collapse
- VERSION =
Holds link to its version module.
JsonRpcObjects::V20
- DATA_MEMBER_NAME =
Indicates data member name.
:data
Instance Attribute Summary
Attributes inherited from JsonRpcObjects::V11::WD::Error
Attributes included from JsonRpcObjects::V11::WD::Extensions
Attributes inherited from JsonRpcObjects::V10::Error
Attributes inherited from Generic::Object
Instance Method Summary collapse
-
#check! ⇒ Object
Checks correctness of the data.
-
#output ⇒ Hash
Renders data to output hash.
Methods inherited from JsonRpcObjects::V11::WD::Error
Methods included from JsonRpcObjects::V11::WD::Extensions
Methods inherited from JsonRpcObjects::V10::Error
Methods inherited from Generic::Object
create, #initialize, parse, #serialize, #to_json, version
Constructor Details
This class inherits a constructor from JsonRpcObjects::Generic::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JsonRpcObjects::V11::WD::Extensions
Instance Method Details
#check! ⇒ Object
Checks correctness of the data.
42 43 44 45 46 47 48 49 50 |
# File 'lib/json-rpc-objects/v20/error.rb', line 42 def check! self.normalize! if ((-32768..-32000).include?(@code)) and not ((@code == -32700) or ((-32603..-32600).include?(@code)) or ((-32099..-32000).include?(code))) raise JsonRpcObjects::Exceptions::InvalidCode::new("Code is invalid because of reserved space.") end end |
#output ⇒ Hash
Renders data to output hash.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/json-rpc-objects/v20/error.rb', line 57 def output result = super() if result.include? "error" result["data"] = result["error"] result.delete("error") end return result end |