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

Reset the error when rcl_take_response failed. #141

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions rclpy/src/rclpy/_rclpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2186,7 +2186,7 @@ rclpy_take_response(PyObject * Py_UNUSED(self), PyObject * args)
rcl_ret_t ret = rcl_take_response(client, header, taken_response);
PyMem_Free(header);

if (ret != RCL_RET_SERVICE_TAKE_FAILED) {
if (ret == RCL_RET_OK) {
PyObject * pyconvert_to_py = PyObject_GetAttrString(pyresponse_type, "_CONVERT_TO_PY");

typedef PyObject *(* convert_to_py_signature)(void *);
Expand All @@ -2202,8 +2202,11 @@ rclpy_take_response(PyObject * Py_UNUSED(self), PyObject * args)

return pytaken_response;
}
// if take_response failed, just do nothing
Py_RETURN_NONE;
PyErr_Format(PyExc_RuntimeError,
"Client failed to take response: %s", rcl_get_error_string_safe());
rcl_reset_error();

return NULL;
}

/// Status of the the client library
Expand Down