From c5d188a1a54a71df82831e71dccbcc1f21cc6a9f Mon Sep 17 00:00:00 2001 From: Seungbaek Hong Date: Wed, 12 Feb 2025 20:55:30 +0900 Subject: [PATCH] [svace] fix some svace issues fixed some svace issues. Signed-off-by: Seungbaek Hong --- Applications/ProductRatings/jni/main.cpp | 1 + nntrainer/nntrainer_error.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Applications/ProductRatings/jni/main.cpp b/Applications/ProductRatings/jni/main.cpp index e3788dc0..4bca5ad6 100644 --- a/Applications/ProductRatings/jni/main.cpp +++ b/Applications/ProductRatings/jni/main.cpp @@ -162,6 +162,7 @@ int main(int argc, char *argv[]) { rng.seed(SEED); std::shared_ptr dataset_train, dataset_val; + try { dataset_train = createDataset(ml::train::DatasetType::GENERATOR, getSample_train); diff --git a/nntrainer/nntrainer_error.h b/nntrainer/nntrainer_error.h index e1293cca..f82188bb 100644 --- a/nntrainer/nntrainer_error.h +++ b/nntrainer/nntrainer_error.h @@ -24,6 +24,7 @@ #endif #include +#include #include #include @@ -103,7 +104,11 @@ public: */ ~ErrorNotification() noexcept(false) { if (cleanup_func) { - cleanup_func(); + try { + cleanup_func(); + } catch (const std::exception &e) { + std::cerr << "Exception during cleanup: " << e.what() << '\n'; + } } throw Err(ss.str().c_str()); } -- 2.34.1