Module: Sinatra::JsonRpc::Helpers
- Defined in:
- lib/sinatra/json_rpc.rb
Instance Method Summary collapse
Instance Method Details
#send_error(code, data = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/sinatra/json_rpc.rb', line 13 def send_error(code, data = nil) resp = Sinatra::JsonRpc::Response.new if @rpc_req resp.id = @rpc_req.id unless @rpc_req.id.nil? end resp.error = code resp.error.data = data unless data.nil? resp.to_json end |