Skip to content

Commit

Permalink
Reset the error when rcl_take_response failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Minggang Wang committed Nov 13, 2017
1 parent 15348af commit 3babf71
Showing 1 changed file with 6 additions and 3 deletions.
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

0 comments on commit 3babf71

Please sign in to comment.