From 987337bf318597865d9a3a0f305eac0f409478a9 Mon Sep 17 00:00:00 2001 From: Tzu-Yu Lee Date: Sun, 18 May 2025 02:49:35 +0800 Subject: [PATCH] feat(trtllm): catch broader exception The trycatch only uses the `what()` method, which means we can catch the broader `std::exception` instead. This is beneficial because nlohmann/json also throws exception. --- backends/trtllm/csrc/ffi.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backends/trtllm/csrc/ffi.hpp b/backends/trtllm/csrc/ffi.hpp index 90d1b9d1..d31743ee 100644 --- a/backends/trtllm/csrc/ffi.hpp +++ b/backends/trtllm/csrc/ffi.hpp @@ -1,6 +1,7 @@ #ifndef TGI_BACKEND_TRTLLM_FFI #define TGI_BACKEND_TRTLLM_FFI +#include #include #include @@ -17,7 +18,7 @@ namespace rust::behavior { template static void trycatch(Try &&func, Fail &&fail) noexcept try { func(); - } catch (tensorrt_llm::common::TllmException &e) { + } catch (const std::exception &e) { fail(e.what()); } }