cdc: add fmt::formatter for exception types in data_dictionary.hh
before this change, we rely on the default-generated fmt::formatter
created from operator<<, but fmt v10 dropped the default-generated
formatter.
in this change, `fmt::formatter<>` is added for following classes for
backward compatibility with {fmt} < 10:
* `data_dictionary::no_such_keyspace`
* `data_dictionary::no_such_column_family`
Refs #13245
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
This commit is contained in:
@@ -128,3 +128,20 @@ public:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#if FMT_VERSION < 100000
|
||||
// fmt v10 introduced formatter for std::exception
|
||||
template <>
|
||||
struct fmt::formatter<data_dictionary::no_such_keyspace> : fmt::formatter<std::string_view> {
|
||||
auto format(const data_dictionary::no_such_keyspace& e, fmt::format_context& ctx) const {
|
||||
return fmt::format_to(ctx.out(), "{}", e.what());
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<data_dictionary::no_such_column_family> : fmt::formatter<std::string_view> {
|
||||
auto format(const data_dictionary::no_such_column_family& e, fmt::format_context& ctx) const {
|
||||
return fmt::format_to(ctx.out(), "{}", e.what());
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user