From 2744871b3e84003a15e0a716fff6fd21e8f81db3 Mon Sep 17 00:00:00 2001 From: anushkrishnav Date: Sat, 11 Jun 2022 07:41:36 +0530 Subject: [PATCH 1/3] feat: try-catch on plugin loading --- xacc/service/ServiceRegistry.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xacc/service/ServiceRegistry.cpp b/xacc/service/ServiceRegistry.cpp index 58c692360..8c7a952ca 100644 --- a/xacc/service/ServiceRegistry.cpp +++ b/xacc/service/ServiceRegistry.cpp @@ -58,7 +58,12 @@ void ServiceRegistry::initialize(const std::string rootPath) { while ((ent2 = readdir(dir2)) != NULL) { if (std::string(ent2->d_name).find("lib") != std::string::npos) { // std::cout << "INSTALLING: " << path << "/" << std::string(ent2->d_name) << "\n"; + try{ context.InstallBundles(path + "/" + std::string(ent2->d_name)); + } catch (std::exception& e) { + XACCLogger::instance()->error("Error installing bundle: " + path + "/" + std::string(ent2->d_name)); + } + } } closedir(dir2); From 5d9702afc1a394df3734fb82d26669af3a1e1268 Mon Sep 17 00:00:00 2001 From: anushkrishnav Date: Fri, 17 Jun 2022 09:03:30 +0530 Subject: [PATCH 2/3] updated try catch to throw and exception --- xacc/service/ServiceRegistry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xacc/service/ServiceRegistry.cpp b/xacc/service/ServiceRegistry.cpp index 8c7a952ca..7d363106e 100644 --- a/xacc/service/ServiceRegistry.cpp +++ b/xacc/service/ServiceRegistry.cpp @@ -84,7 +84,7 @@ void ServiceRegistry::initialize(const std::string rootPath) { try { b.Start(); } catch (std::exception &e) { - xacc::error("Could not load " + b.GetSymbolicName() + ", error message: " + e.what()); + xacc::exception("Could not load " + b.GetSymbolicName() + ", error message: " + e.what()); } } From 101c8390cc254f0061ea69f7bcf851f778dc8461 Mon Sep 17 00:00:00 2001 From: anushkrishnav <54374648+anushkrishnav@users.noreply.github.com> Date: Sat, 18 Jun 2022 11:52:06 +0530 Subject: [PATCH 3/3] Update ServiceRegistry.cpp --- xacc/service/ServiceRegistry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xacc/service/ServiceRegistry.cpp b/xacc/service/ServiceRegistry.cpp index 7d363106e..d84cb4185 100644 --- a/xacc/service/ServiceRegistry.cpp +++ b/xacc/service/ServiceRegistry.cpp @@ -84,7 +84,7 @@ void ServiceRegistry::initialize(const std::string rootPath) { try { b.Start(); } catch (std::exception &e) { - xacc::exception("Could not load " + b.GetSymbolicName() + ", error message: " + e.what()); + xacc::warning("Could not load " + b.GetSymbolicName() + ", error message: " + e.what()); } }