mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-07-30 03:40:17 +00:00
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:
parent
27d03309c9
commit
987337bf31
@ -1,6 +1,7 @@
|
|||||||
#ifndef TGI_BACKEND_TRTLLM_FFI
|
#ifndef TGI_BACKEND_TRTLLM_FFI
|
||||||
#define TGI_BACKEND_TRTLLM_FFI
|
#define TGI_BACKEND_TRTLLM_FFI
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ namespace rust::behavior {
|
|||||||
template<typename Try, typename Fail>
|
template<typename Try, typename Fail>
|
||||||
static void trycatch(Try &&func, Fail &&fail) noexcept try {
|
static void trycatch(Try &&func, Fail &&fail) noexcept try {
|
||||||
func();
|
func();
|
||||||
} catch (tensorrt_llm::common::TllmException &e) {
|
} catch (const std::exception &e) {
|
||||||
fail(e.what());
|
fail(e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user