From 8e9eecc288aaba8ea96ccb5b7d5441b21f415fad Mon Sep 17 00:00:00 2001 From: Frede Hoey Braendstrup Date: Mon, 20 Apr 2026 11:46:27 +0200 Subject: [PATCH] Use FMT_TRY and FMT_CATCH in C api If exceptions are disabled, try/catch don't compile --- src/fmt-c.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fmt-c.cc b/src/fmt-c.cc index cb7dcc1c..5faa7470 100644 --- a/src/fmt-c.cc +++ b/src/fmt-c.cc @@ -31,12 +31,12 @@ extern "C" int fmt_vformat(char* buffer, size_t size, const char* fmt, default: return fmt_error_invalid_arg; } } - try { + FMT_TRY { auto result = fmt::vformat_to_n( buffer, size, fmt, fmt::format_args(format_args, static_cast(num_args))); return static_cast(result.size); - } catch (...) { + } FMT_CATCH(...) { } return fmt_error; }