Currently, rpc code may return the wrong RPCErrorCode. This is perfectly fine, because they should be hit rarely in production.
However, it could be good to be self-consistent. (Otherwise, we could just remove the different error codes and return a single one)
So fix a few error codes:
- An integral out-of-range is now
RPC_TYPE_ERROR, notRPC_MISC_ERROR - Some invalid args are now
RPC_INVALID_PARAMETER - Some transient issues or user-config issues are now
RPC_MISC_ERROR - Finally,
RPC_INTERNAL_ERRORis reserved for internal bugs or internal corruption