Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log format of service exception handler #2321

Open
destroy314 opened this issue Mar 28, 2023 · 0 comments
Open

Log format of service exception handler #2321

destroy314 opened this issue Mar 28, 2023 · 0 comments

Comments

@destroy314
Copy link

When an exception raised in callback function of a service ,this function will log it to rosout:

def error_handler(self, e, exc_type, exc_value, tb):
logerr("Error processing request: %s\n%s" % (e, traceback.format_exception(exc_type, exc_value, tb)))

However the return value of traceback.format_exception() is a list which cause it's hard to read the traceback message:

[ERROR] [1680007708.746949]: Error processing request:['Traceback (most recent call last):\n', '  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 633,in _handle_request\n    response = convert_return_to_response(self.handler(request), self.response_class)\n', ...

Can we use ''.join() or traceback.format_exc() like the code below to get a better format?

logerr("bad callback: %s\n%s"%(cb, traceback.format_exc()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant