-- -*- M2-comint -*- hash: 15308001505744095674

i1 : server = new JSONRPCServer

o1 = server

o1 : JSONRPCServer

i2 : registerMethod(server, "divide", (x, y) -> x/y)

i3 : handleRequest(server, makeRequest("divide", {1, 0}, 1))

o3 = {"error": {"code": -32602, "message": "Invalid params"}, "jsonrpc":
     "2.0", "id": 1}

i4 : registerMethod(server, "divide", (x, y) -> (
             if zero y then JSONRPCError(-32001, "division by zero")
             else x/y))

i5 : handleRequest(server, makeRequest("divide", {1, 0}, 1))

o5 = {"error": {"code": -32001, "message": "division by zero"}, "jsonrpc":
     "2.0", "id": 1}

i6 : handleRequest(server, makeRequest("divide", {22, 7}, 1))

o6 = {"result": 3.142857142857143, "jsonrpc": "2.0", "id": 1}

i7 : 
