Use FMT_TRY and FMT_CATCH in C api

If exceptions are disabled, try/catch don't compile
This commit is contained in:
Frede Hoey Braendstrup 2026-04-20 11:46:27 +02:00
parent 2cb3983213
commit 8e9eecc288
No known key found for this signature in database
GPG Key ID: 0F40306414D0827E

View File

@ -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<int>(num_args)));
return static_cast<int>(result.size);
} catch (...) {
} FMT_CATCH(...) {
}
return fmt_error;
}