mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-04 15:14:39 +00:00
Merge pull request #79 from bufferbase/patch-1
Fix incorrect message when mUsedName is empty
This commit is contained in:
commit
37264dc7f8
@ -452,8 +452,10 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
if (mValues.size() != expected && !mDefaultValue.has_value()) {
|
if (mValues.size() != expected && !mDefaultValue.has_value()) {
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << mUsedName << ": expected " << *expected << " argument(s). "
|
if (!mUsedName.empty())
|
||||||
<< mValues.size() << " provided.";
|
stream << mUsedName << ": ";
|
||||||
|
stream << *expected << " argument(s) expected. " << mValues.size()
|
||||||
|
<< " provided.";
|
||||||
throw std::runtime_error(stream.str());
|
throw std::runtime_error(stream.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user