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.
This commit is contained in:
Tzu-Yu Lee 2025-05-18 02:49:35 +08:00
parent 27d03309c9
commit 987337bf31

View File

@ -1,6 +1,7 @@
#ifndef TGI_BACKEND_TRTLLM_FFI
#define TGI_BACKEND_TRTLLM_FFI
#include <exception>
#include <memory>
#include <thread>
@ -17,7 +18,7 @@ namespace rust::behavior {
template<typename Try, typename Fail>
static void trycatch(Try &&func, Fail &&fail) noexcept try {
func();
} catch (tensorrt_llm::common::TllmException &e) {
} catch (const std::exception &e) {
fail(e.what());
}
}