Skip to content

Commit

Permalink
Add exception stacktrace logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Rigal committed Aug 7, 2019
1 parent c68065c commit 9af64bc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/actionlib_enhanced/action_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# coding: utf-8

import threading
from multiprocessing import Queue
import rospy
import traceback
from multiprocessing import Queue
from actionlib import ActionServer
from actionlib.action_server import ServerGoalHandle

Expand Down Expand Up @@ -87,8 +88,10 @@ def execute_server_callback(self, goal_handle):
self.lock.release()
try:
self.execute_callback(goal_handle.get_goal())
except (KeyboardInterrupt, SystemExit):
raise
except Exception as e:
rospy.logerr("Error in the actionlib server callback: {}".format(e))
rospy.logerr("Error in the actionlib server callback: {}".format(traceback.format_exc()))
finally:
if self.ghDict.has_key(threading.current_thread().ident):
rospy.logwarn("The actionlib server callback did not set the goal as succeeded, sending unsuccessful result")
Expand Down

0 comments on commit 9af64bc

Please sign in to comment.