Module: RPC::Encoders::Json::Errors
Overview
Instance Method Summary collapse
- #error(message, code, object) ⇒ Object
- #exception(exception, code = 000, message = "#{exception.class}: #{exception.message}") ⇒ Object
Instance Method Details
#error(message, code, object) ⇒ Object
30 31 32 33 34 |
# File 'lib/rpc/lib/rpc/encoders/json.rb', line 30 def error(, code, object) error = {name: "JSONRPCError", code: code, message: , error: object} RPC.log "ERROR #{} (#{code}) #{error[:error].inspect}" error end |
#exception(exception, code = 000, message = "#{exception.class}: #{exception.message}") ⇒ Object
Note:
The exceptions are “eaten”, because no client should be able to shut the server down.
21 22 23 24 25 26 27 28 |
# File 'lib/rpc/lib/rpc/encoders/json.rb', line 21 def exception(exception, code = 000, = "#{exception.class}: #{exception.}") unless RPC.development? object = {class: exception.class.to_s, message: exception., backtrace: exception.backtrace} self.error(, code, object) else raise exception end end |