From c71b526d36875cd98ae5eb9a5fc9fda000bbe5e4 Mon Sep 17 00:00:00 2001
From: Christoph Pohl <christoph.pohl@kit.edu>
Date: Thu, 16 Feb 2023 15:24:06 +0100
Subject: [PATCH] Add Improved exception message handling

---
 .../provider/detail/SkillImplementationWrapper.cpp   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp b/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp
index 1fb8c3ac5..81e91b131 100644
--- a/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp
+++ b/source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp
@@ -86,7 +86,7 @@ namespace armarx
             }
             catch (const std::exception& ex)
             {
-                std::string message = "SkillError 101e: An error occured during the check whether skill '" + skillName + "' is available. The error was: " + ex.what();
+                std::string message = "SkillError 101e: An error occured during the check whether skill '" + skillName + "' is available. The error was: " + GetHandledExceptionString();
                 ARMARX_ERROR_S << message;
                 resetExecParam();
                 return TerminatedSkillStatusUpdate({{skill->getSkillId(), executorName, parameterization, createErrorMessage(message)}, TerminatedSkillStatus::Failed});
@@ -102,7 +102,7 @@ namespace armarx
             }
             catch (const std::exception& ex)
             {
-                std::string message = "SkillError 201e: An error occured during the reset of skill '" + skillName + "'. The error was: " + ex.what();
+                std::string message = "SkillError 201e: An error occured during the reset of skill '" + skillName + "'. The error was: " + GetHandledExceptionString();
                 ARMARX_ERROR_S << message;
 
                 updateStatus(SkillStatus::Failed);
@@ -116,7 +116,7 @@ namespace armarx
             }
             catch (const std::exception& ex)
             {
-                std::string message = "SkillError 301e: An error occured during waiting for skill dependencies of skill '" + skillName + "'. The error was: " + ex.what();
+                std::string message = "SkillError 301e: An error occured during waiting for skill dependencies of skill '" + skillName + "'. The error was: " + GetHandledExceptionString();
                 ARMARX_ERROR_S << message;
 
                 updateStatus(SkillStatus::Failed);
@@ -143,7 +143,7 @@ namespace armarx
             }
             catch (const std::exception& ex)
             {
-                std::string message = "SkillError 401e: An error occured during the initialization of skill '" + skillName + "'. The error was: " + ex.what();
+                std::string message = "SkillError 401e: An error occured during the initialization of skill '" + skillName + "'. The error was: " + GetHandledExceptionString();
                 ARMARX_ERROR_S << message;
                 skill->exitSkill({executorName, aron_params}); // try to exit skill. Ignore return value
 
@@ -174,7 +174,7 @@ namespace armarx
             }
             catch (const std::exception& ex)
             {
-                std::string message = "SkillError 501e: An error occured during the main method of skill '" + skillName + "'. The error was: " + ex.what();
+                std::string message = "SkillError 501e: An error occured during the main method of skill '" + skillName + "'. The error was: " + GetHandledExceptionString();
                 ARMARX_ERROR_S << message;
                 skill->exitSkill({executorName, aron_params}); // try to exit skill. Ignore return value
 
@@ -199,7 +199,7 @@ namespace armarx
             }
             catch (const std::exception& ex)
             {
-                std::string message = "SkillError 601e: An error occured during the exit method of skill '" + skillName + "'. The error was: " + ex.what();
+                std::string message = "SkillError 601e: An error occured during the exit method of skill '" + skillName + "'. The error was: " + GetHandledExceptionString();
                 ARMARX_ERROR_S << message;
 
                 updateStatus(SkillStatus::Failed);
-- 
GitLab