| 500 | } |
| 501 | |
| 502 | static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& request, UniValue& result, bool last_handler) |
| 503 | { |
| 504 | try { |
| 505 | RPCCommandExecution execution(request.strMethod); |
| 506 | // Execute, convert arguments to array if necessary |
| 507 | if (request.params.isObject()) { |
| 508 | return command.actor(transformNamedArguments(request, command.argNames), result, last_handler); |
| 509 | } else { |
| 510 | return command.actor(request, result, last_handler); |
| 511 | } |
| 512 | } catch (const UniValue::type_error& e) { |
| 513 | throw JSONRPCError(RPC_TYPE_ERROR, e.what()); |
| 514 | } catch (const std::exception& e) { |
| 515 | throw JSONRPCError(RPC_MISC_ERROR, e.what()); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | std::vector<std::string> CRPCTable::listCommands() const |
| 520 | { |
no test coverage detected