Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
6cff60da
Commit
6cff60da
authored
7 months ago
by
Fabian Reister
Browse files
Options
Downloads
Patches
Plain Diff
SkillImplementationWrapper: returning result data in case of failure (stead of errormessage)
parent
9e4811f6
No related branches found
Branches containing commit
No related tags found
1 merge request
!484
SkillImplementationWrapper: returning result data in case of failure (stead of errormessage)
Pipeline
#21143
failed
7 months ago
Stage: build-and-test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp
+28
-27
28 additions, 27 deletions
...ies/skills/provider/detail/SkillImplementationWrapper.cpp
with
28 additions
and
27 deletions
source/RobotAPI/libraries/skills/provider/detail/SkillImplementationWrapper.cpp
+
28
−
27
View file @
6cff60da
...
...
@@ -130,9 +130,9 @@ namespace armarx
// set initial parameters that were attached to the execution request (only add as we are not sure whether some updates already arrived)
this
->
updateSkillParameters
(
initial_aron_params
);
auto
makeAbortedResult
=
[
&
](
const
std
::
string
&
message
)
auto
makeAbortedResult
=
[
&
](
const
aron
::
data
::
DictPtr
&
data
)
{
updateStatus
(
SkillStatus
::
Aborted
,
createErrorMessageData
(
message
)
);
updateStatus
(
SkillStatus
::
Aborted
,
data
);
std
::
unique_lock
l
(
skillStatusesMutex
);
auto
terminated
=
TerminatedSkillStatusUpdate
{
...
...
@@ -145,9 +145,9 @@ namespace armarx
};
auto
makeFailedResult
=
[
&
](
const
std
::
string
&
message
)
auto
makeFailedResult
=
[
&
](
const
aron
::
data
::
DictPtr
&
data
)
{
updateStatus
(
SkillStatus
::
Failed
,
createErrorMessageData
(
message
)
);
updateStatus
(
SkillStatus
::
Failed
,
data
);
std
::
unique_lock
l
(
skillStatusesMutex
);
auto
terminated
=
TerminatedSkillStatusUpdate
{
...
...
@@ -174,15 +174,15 @@ namespace armarx
// }
auto
exitAndMakeFailedResult
=
[
&
](
const
std
::
string
&
message
)
auto
exitAndMakeFailedResult
=
[
&
](
const
aron
::
data
::
DictPtr
&
data
)
{
skill
->
exitSkill
();
// try to exit skill. Ignore return value
return
makeFailedResult
(
message
);
return
makeFailedResult
(
data
);
};
auto
exitAndMakeAbortedResult
=
[
&
](
const
std
::
string
&
message
)
auto
exitAndMakeAbortedResult
=
[
&
](
const
aron
::
data
::
DictPtr
&
data
)
{
skill
->
exitSkill
();
// try to exit skill. Ignore return value
return
makeAbortedResult
(
message
);
return
makeAbortedResult
(
data
);
};
// Construction succeeded!
...
...
@@ -199,16 +199,16 @@ namespace armarx
{
std
::
string
message
=
"SkillError 101: The initialization of skill '"
+
skillName
+
"' did not succeed."
;
return
exitAndMakeFailedResult
(
message
);
return
exitAndMakeFailedResult
(
createErrorMessageData
(
message
)
)
;
}
}
catch
(
const
error
::
SkillAbortedException
&
ex
)
{
return
exitAndMakeAbortedResult
(
GetHandledExceptionString
());
return
exitAndMakeAbortedResult
(
createErrorMessageData
(
GetHandledExceptionString
())
)
;
}
catch
(
const
error
::
SkillFailedException
&
ex
)
{
return
exitAndMakeFailedResult
(
GetHandledExceptionString
());
return
exitAndMakeFailedResult
(
createErrorMessageData
(
GetHandledExceptionString
())
)
;
}
catch
(
const
std
::
exception
&
ex
)
{
...
...
@@ -216,7 +216,7 @@ namespace armarx
"SkillError 101e: An error occured during the initialization of skill '"
+
skillName
+
"'. The error was: "
+
GetHandledExceptionString
();
ARMARX_ERROR_S
<<
message
;
return
exitAndMakeFailedResult
(
message
);
return
exitAndMakeFailedResult
(
createErrorMessageData
(
message
)
)
;
}
// Init succeeded!
...
...
@@ -244,16 +244,16 @@ namespace armarx
std
::
string
message
=
"SkillError 201: The prepare method of skill '"
+
skillName
+
"' did not succeed."
;
ARMARX_ERROR_S
<<
message
;
return
exitAndMakeFailedResult
(
message
);
return
exitAndMakeFailedResult
(
createErrorMessageData
(
message
)
)
;
}
}
catch
(
const
error
::
SkillAbortedException
&
ex
)
{
return
exitAndMakeAbortedResult
(
GetHandledExceptionString
());
return
exitAndMakeAbortedResult
(
createErrorMessageData
(
GetHandledExceptionString
())
)
;
}
catch
(
const
error
::
SkillFailedException
&
ex
)
{
return
exitAndMakeFailedResult
(
GetHandledExceptionString
());
return
exitAndMakeFailedResult
(
createErrorMessageData
(
GetHandledExceptionString
())
)
;
}
catch
(
const
std
::
exception
&
ex
)
{
...
...
@@ -262,7 +262,7 @@ namespace armarx
skillName
+
"'. The error was: "
+
GetHandledExceptionString
();
ARMARX_ERROR_S
<<
message
;
return
exitAndMakeFailedResult
(
message
);
return
exitAndMakeFailedResult
(
createErrorMessageData
(
message
)
)
;
}
// Prepare succeeded!
...
...
@@ -281,22 +281,23 @@ namespace armarx
{
std
::
string
message
=
"SkillError 501: The main method of skill '"
+
skillName
+
"' did fail."
;
return
exitAndMakeFailedResult
(
message
);
return
exitAndMakeFailedResult
(
mainRet
.
data
);
}
else
if
(
mainRet
.
status
==
TerminatedSkillStatus
::
Aborted
)
{
std
::
string
message
=
"SkillError 501: The main method of skill '"
+
skillName
+
"' got aborted."
;
return
exitAndMakeAbortedResult
(
m
essage
);
return
exitAndMakeAbortedResult
(
m
ainRet
.
data
);
}
}
catch
(
const
error
::
SkillAbortedException
&
ex
)
{
return
exitAndMakeAbortedResult
(
GetHandledExceptionString
()
);
return
exitAndMakeAbortedResult
(
mainRet
.
data
);
}
catch
(
const
error
::
SkillFailedException
&
ex
)
{
return
exitAndMakeFailedResult
(
GetHandledExceptionString
()
);
return
exitAndMakeFailedResult
(
mainRet
.
data
);
}
catch
(
const
std
::
exception
&
ex
)
{
...
...
@@ -304,7 +305,7 @@ namespace armarx
"SkillError 501e: An error occured during the main method of skill '"
+
skillName
+
"'. The error was: "
+
GetHandledExceptionString
();
ARMARX_ERROR_S
<<
message
;
return
exitAndMakeFailedResult
(
m
essage
);
return
exitAndMakeFailedResult
(
m
ainRet
.
data
);
}
// Main succeeded!
...
...
@@ -317,18 +318,18 @@ namespace armarx
Skill
::
ExitResult
exitRet
=
skill
->
exitSkill
();
if
(
exitRet
.
status
!=
TerminatedSkillStatus
::
Succeeded
)
{
std
::
string
message
=
"SkillError 601: The exit method of skill '"
+
skillName
+
"' did not succeed."
;
return
makeFailedResult
(
m
essage
);
//
std::string message = "SkillError 601: The exit method of skill '" + skillName +
//
"' did not succeed.";
return
makeFailedResult
(
m
ainRet
.
data
);
}
}
catch
(
const
error
::
SkillAbortedException
&
ex
)
{
return
makeAbortedResult
(
GetHandledExceptionString
()
);
return
makeAbortedResult
(
mainRet
.
data
);
}
catch
(
const
error
::
SkillFailedException
&
ex
)
{
return
makeFailedResult
(
GetHandledExceptionString
()
);
return
makeFailedResult
(
mainRet
.
data
);
}
catch
(
const
std
::
exception
&
ex
)
{
...
...
@@ -336,7 +337,7 @@ namespace armarx
"SkillError 601e: An error occured during the exit method of skill '"
+
skillName
+
"'. The error was: "
+
GetHandledExceptionString
();
ARMARX_ERROR_S
<<
message
;
return
makeFailedResult
(
m
essage
);
return
makeFailedResult
(
m
ainRet
.
data
);
}
// Exit succeeded!
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment