Skip to content

Commit

Permalink
Merge pull request #79 from bufferbase/patch-1
Browse files Browse the repository at this point in the history
Fix incorrect message when mUsedName is empty
  • Loading branch information
p-ranav authored Jun 5, 2020
2 parents 176da54 + 43f4629 commit 37264dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,10 @@ class Argument {
} else {
if (mValues.size() != expected && !mDefaultValue.has_value()) {
std::stringstream stream;
stream << mUsedName << ": expected " << *expected << " argument(s). "
<< mValues.size() << " provided.";
if (!mUsedName.empty())
stream << mUsedName << ": ";
stream << *expected << " argument(s) expected. " << mValues.size()
<< " provided.";
throw std::runtime_error(stream.str());
}
}
Expand Down

0 comments on commit 37264dc

Please sign in to comment.