Skip to content

Commit

Permalink
Clear rcutils error on failure
Browse files Browse the repository at this point in the history
rcutils logging sets error messages on failure as of ros2/rcutils#65
  • Loading branch information
dhood committed Dec 1, 2017
1 parent c389052 commit 7bbecc8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rclpy/src/rclpy/_rclpy_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ rclpy_logging_initialize(PyObject * Py_UNUSED(self), PyObject * Py_UNUSED(args))
if (ret != RCUTILS_RET_OK) {
PyErr_Format(PyExc_RuntimeError,
"Failed to initialize logging system, return code: %d\n", ret);
rcutils_reset_error();
return NULL;
}
Py_RETURN_NONE;
Expand All @@ -48,6 +49,7 @@ rclpy_logging_shutdown(PyObject * Py_UNUSED(self), PyObject * Py_UNUSED(args))
if (ret != RCUTILS_RET_OK) {
PyErr_Format(PyExc_RuntimeError,
"Failed to shutdown logging system, return code: %d\n", ret);
rcutils_reset_error();
return NULL;
}
Py_RETURN_NONE;
Expand All @@ -73,6 +75,7 @@ rclpy_logging_get_logger_severity_threshold(PyObject * Py_UNUSED(self), PyObject
PyErr_Format(PyExc_RuntimeError,
"Failed to get severity threshold for logger \"%s\", return code: %d\n",
name, severity);
rcutils_reset_error();
return NULL;
}
return PyLong_FromLong(severity);
Expand Down Expand Up @@ -100,6 +103,7 @@ rclpy_logging_set_logger_severity_threshold(PyObject * Py_UNUSED(self), PyObject
PyErr_Format(PyExc_RuntimeError,
"Failed to set severity threshold \"%d\" for logger \"%s\", return code: %d\n",
severity, name, ret);
rcutils_reset_error();
return NULL;
}
Py_RETURN_NONE;
Expand Down Expand Up @@ -128,6 +132,7 @@ rclpy_logging_get_logger_effective_severity_threshold(PyObject * Py_UNUSED(self)
PyErr_Format(PyExc_RuntimeError,
"Failed to get effective severity threshold for logger \"%s\", return code: %d\n",
name, severity);
rcutils_reset_error();
return NULL;
}
return PyLong_FromLong(severity);
Expand Down

0 comments on commit 7bbecc8

Please sign in to comment.