diff --git a/llarp/config/config.cpp b/llarp/config/config.cpp index 30cc9a9b5..b718de338 100644 --- a/llarp/config/config.cpp +++ b/llarp/config/config.cpp @@ -431,14 +431,14 @@ namespace llarp conf.defineOption( "lokid", "enabled", false, DefaultWhitelistRouters, AssignmentAcceptor(whitelistRouters)); - conf.defineOption( - "lokid", - "jsonrpc", - false, - "", - InvalidOption("the [lokid]::jsonrpc option is deprecated please use the " - "[lokid]::rpc " - "config option instead")); + conf.defineOption("lokid", "jsonrpc", false, "", [](std::string arg) { + if (arg.empty()) + return; + throw std::invalid_argument( + "the [lokid]::jsonrpc option is deprecated please use the " + "[lokid]::rpc " + "config option instead"); + }); conf.defineOption( "lokid", "rpc", false, DefaultLokidRPCAddr, [this](std::string arg) { diff --git a/llarp/config/definition.hpp b/llarp/config/definition.hpp index 394b2aead..f58f91d4d 100644 --- a/llarp/config/definition.hpp +++ b/llarp/config/definition.hpp @@ -448,14 +448,4 @@ namespace llarp return [&](T arg) mutable { ref = std::move(arg); }; } - /// A wrapper that throws an invalid argument exception if the argument is provided in config - /// the invalid_arugment exception is constructed using a string that holds the exception's - /// message - template - std::function - InvalidOption(std::string msg) - { - return [msg](T) mutable { throw std::invalid_argument(msg); }; - } - } // namespace llarp