Open
Description
If there is an unhandled type_error thrown in the rpc method itself, the error should be an internal error not an invalid parameters error. For example, this program
#include "nlohmann/json.hpp"
#include "jsonrpccxx/server.hpp"
#include <iostream>
std::string do_something()
{
nlohmann::json json = 0;
std::string my_string = json;
return my_string;
}
int main()
{
jsonrpccxx::JsonRpc2Server handler;
handler.Add("do_something", jsonrpccxx::GetHandle(&do_something), {});
std::string request = R"({"jsonrpc": "2.0", "id": 0, "method": "do_something", "params": []})";
std::cout << handler.HandleRequest(request) << std::endl;
}
prints
{"error":{"code":-32602,"message":"invalid parameter: [json.exception.type_error.302] type must be string, but is number"},"id":0,"jsonrpc":"2.0"}
which doesn't make sense because the exception is thrown in the body of do_something
, not when converting parameters.
Metadata
Metadata
Assignees
Labels
No labels