- : std::runtime_error(to<std::string>("TypeError: expected dynamic "
- "type `", expected, '\'', ", but had type `",
- dynamic::typeName(actual), '\''))
-{}
-
-TypeError::TypeError(const std::string& expected,
- dynamic::Type actual1, dynamic::Type actual2)
- : std::runtime_error(to<std::string>("TypeError: expected dynamic "
- "types `", expected, '\'', ", but had types `",
- dynamic::typeName(actual1), "' and `", dynamic::typeName(actual2),
- '\''))
-{}
+ : std::runtime_error(sformat(
+ "TypeError: expected dynamic type `{}', but had type `{}'",
+ expected,
+ dynamic::typeName(actual))) {}
+
+TypeError::TypeError(
+ const std::string& expected,
+ dynamic::Type actual1,
+ dynamic::Type actual2)
+ : std::runtime_error(sformat(
+ "TypeError: expected dynamic types `{}, but had types `{}' and `{}'",
+ expected,
+ dynamic::typeName(actual1),
+ dynamic::typeName(actual2))) {}