Module: Saorin
- Defined in:
- lib/saorin.rb,
lib/saorin/test.rb,
lib/saorin/error.rb,
lib/saorin/client.rb,
lib/saorin/server.rb,
lib/saorin/request.rb,
lib/saorin/utility.rb,
lib/saorin/version.rb,
lib/saorin/dumpable.rb,
lib/saorin/response.rb,
lib/saorin/formatter.rb,
lib/saorin/client/base.rb,
lib/saorin/server/base.rb,
lib/saorin/server/rack.rb,
lib/saorin/registerable.rb,
lib/saorin/client/faraday.rb
Defined Under Namespace
Modules: Client, Dumpable, Formatter, Registerable, Server, Test, Utility Classes: AdapterNotFound, Error, InvalidResponse, RPCError, Request, Response, ServerError, UserDefinedError
Constant Summary collapse
- JSON_RPC_VERSION =
'2.0'
- JSON_RPC_ERRORS =
code message meaning -32700 Parse error Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. -32600 Invalid Request The JSON sent is not a valid Request object. -32601 Method not found The method does not exist / is not available. -32602 Invalid params Invalid method parameter(s). -32603 Internal error Internal JSON-RPC error. -32000 to -32099 Server error Reserved for implementation-defined server-errors.
[ [-32700, :ParseError, 'Parse error'], [-32600, :InvalidRequest, 'Invalid Request'], [-32601, :MethodNotFound, 'Method not found'], [-32602, :InvalidParams, 'Invalid params'], [-32603, :InternalError, 'Internal error'], ]
- VERSION =
'0.6.0'
Class Method Summary collapse
Class Method Details
.code_to_error(code) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/saorin/error.rb', line 65 def code_to_error(code) case code when nil nil when (-32099..-32000) ServerError else @error_code_map ||= Hash[JSON_RPC_ERRORS.map { |c, n, m| [c, const_get(n)] }] @error_code_map[code] || UserDefinedError end end |