add vararg versions of Error::all() and Error::one() plus unit tests

This commit is contained in:
Axel Kohlmeyer
2021-04-25 19:04:49 -04:00
parent 60c2d8ea5b
commit 4e25204296
3 changed files with 89 additions and 3 deletions

View File

@ -213,6 +213,30 @@ void Error::one(const std::string &file, int line, const std::string &str)
#endif
}
/* ----------------------------------------------------------------------
forward vararg version to single string version
------------------------------------------------------------------------- */
void Error::_all(const std::string &file, int line, fmt::string_view format,
fmt::format_args args)
{
try {
all(file,line,fmt::vformat(format, args));
} catch (fmt::format_error &e) {
all(file,line,e.what());
}
}
void Error::_one(const std::string &file, int line, fmt::string_view format,
fmt::format_args args)
{
try {
one(file,line,fmt::vformat(format, args));
} catch (fmt::format_error &e) {
one(file,line,e.what());
}
}
/* ----------------------------------------------------------------------
called by one proc in world
only write to screen if non-nullptr on this proc since could be file