MCPcopy Create free account
hub / github.com/ElementsProject/elements / RpcHandlerImpl

Method RpcHandlerImpl

src/node/interfaces.cpp:416–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414{
415public:
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 {

Callers

nothing calls this directly

Calls 3

isNumMethod · 0.80
get_intMethod · 0.80
appendCommandMethod · 0.80

Tested by

no test coverage detected