-inline void FormatArg::error(Args&&... args) const {
- throw std::invalid_argument(to<std::string>(
- "folly::format: invalid format argument {", fullArgString, "}: ",
- std::forward<Args>(args)...));
+inline std::string FormatArg::errorStr(Args&&... args) const {
+ return to<std::string>(
+ "invalid format argument {", fullArgString, "}: ",
+ std::forward<Args>(args)...);
+}
+
+template <typename... Args>
+[[noreturn]] inline void FormatArg::error(Args&&... args) const {
+ throwBadFormatArg(errorStr(std::forward<Args>(args)...));