diff --git a/include/fmt/std.h b/include/fmt/std.h index b686d0e1..f5236715 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -16,6 +16,7 @@ #include #include +#include "format.h" #include "ostream.h" #if FMT_HAS_INCLUDE() @@ -234,13 +235,14 @@ struct formatter< auto out = ctx.out(); out = detail::write(out, "variant("); - try { + FMT_TRY { std::visit( [&](const auto& v) { out = detail::write_variant_alternative(out, v); }, value); - } catch (const std::bad_variant_access&) { + } + FMT_CATCH(const std::bad_variant_access&) { detail::write(out, "valueless by exception"); } *out++ = ')';