beam icon indicating copy to clipboard operation
beam copied to clipboard

json array in api errors

Open chapati opened this issue 4 years ago • 0 comments

Need to add more detailed error messages for json arrays, now typecast fails in json library and doesn't print incorrect parameter name

POST http://127.0.0.1:10000/api/wallet HTTP/1.1 content-type: application/json-rpc

{ "jsonrpc": "2.0", "id": 1236, "method": "process_invoke_data", "params": { "data": ["a", "b", "c"] } }

Result:

HTTP/1.1 200 OK Content-Type: application/json Content-Length: 158

{ "error": { "code": -32600, "data": "[json.exception.type_error.302] type must be number, but is string", <-- print correct param name here "message": "Invalid JSON-RPC." }, "id": 1236, "jsonrpc": "2.0" }

chapati avatar Apr 16 '21 21:04 chapati