Open samkottler opened 1 month ago
Do you have a reference to the spec that supports this idea?
In my opinion if there is something wrong with parameters, it is fine to return this error
I agree that if something is wrong with the parameters, this is the correct response. However, my example shows the opposite problem. It returns the invalid parameters error even though the actual error has nothing to do with the parameters.
Sorry, I shouldn't answer in the middle of the night. You are totally right about this. The issue is here I guess: https://github.com/jsonrpcx/json-rpc-cxx/blob/master/include/jsonrpccxx/dispatcher.hpp#L59
We need to catch errors coming from functions earlier before we fall into this catch block.
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
prints
which doesn't make sense because the exception is thrown in the body of
do_something
, not when converting parameters.