| 414 | { |
| 415 | public: |
| 416 | explicit RpcHandlerImpl(const CRPCCommand& command) : m_command(command), m_wrapped_command(&command) |
| 417 | { |
| 418 | m_command.actor = [this](const JSONRPCRequest& request, UniValue& result, bool last_handler) { |
| 419 | if (!m_wrapped_command) return false; |
| 420 | try { |
| 421 | return m_wrapped_command->actor(request, result, last_handler); |
| 422 | } catch (const UniValue& e) { |
| 423 | // If this is not the last handler and a wallet not found |
| 424 | // exception was thrown, return false so the next handler can |
| 425 | // try to handle the request. Otherwise, reraise the exception. |
| 426 | if (!last_handler) { |
| 427 | const UniValue& code = e["code"]; |
| 428 | if (code.isNum() && code.get_int() == RPC_WALLET_NOT_FOUND) { |
| 429 | return false; |
| 430 | } |
| 431 | } |
| 432 | throw; |
| 433 | } |
| 434 | }; |
| 435 | ::tableRPC.appendCommand(m_command.name, &m_command); |
| 436 | } |
| 437 | |
| 438 | void disconnect() final |
| 439 | { |
nothing calls this directly
no test coverage detected