diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index c7719fe..8829f31 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -472,7 +472,8 @@ public: } else if (mDefaultValue.has_value()) { return start; } else { - throw std::runtime_error("Too few arguments"); + throw std::runtime_error("Too few arguments for '" + + std::string(mUsedName) + "'."); } } diff --git a/test/test_parse_args.cpp b/test/test_parse_args.cpp index f77d122..146dfff 100644 --- a/test/test_parse_args.cpp +++ b/test/test_parse_args.cpp @@ -7,7 +7,7 @@ TEST_CASE("Missing argument" * test_suite("parse_args")) { argparse::ArgumentParser program("test"); program.add_argument("--config").nargs(1); REQUIRE_THROWS_WITH_AS(program.parse_args({ "test", "--config" }), - "Too few arguments", + "Too few arguments for '--config'.", std::runtime_error); }