bt2: make log functions clear error indicator
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_component_class.i.h
index 23e7d06a0dbcc5f1c831fa7b1bff588f490c2ef7..a80d059d052b7964d16d4f48ea4933053ca1d57a 100644 (file)
@@ -505,16 +505,15 @@ void component_class_finalize(bt_self_component *self_component)
                bt_logging_level log_level = get_self_component_log_level(
                        self_component);
 
-               BT_COMP_LOG_CUR_LVL(BT_LOG_WARNING, log_level, self_component,
-                       "User component's _user_finalize() method raised an exception: ignoring:");
-               logw_exception(log_level);
-
                /*
                 * Ignore any exception raised by the _user_finalize() method
                 * because it won't change anything at this point: the component
                 * is being destroyed anyway.
                 */
-               PyErr_Clear();
+               BT_COMP_LOG_CUR_LVL(BT_LOG_WARNING, log_level, self_component,
+                       "User component's _user_finalize() method raised an exception: ignoring:");
+               logw_exception_clear(log_level);
+
                goto end;
        }
 
@@ -1181,17 +1180,15 @@ void component_class_message_iterator_finalize(
                bt_logging_level log_level = get_self_component_log_level(
                        self_comp);
 
-               BT_COMP_LOG_CUR_LVL(BT_LOG_WARNING, log_level, self_comp,
-                       "User's _user_finalize() method raised an exception: ignoring:");
-               logw_exception(get_self_message_iterator_log_level(
-                       message_iterator));
-
                /*
                 * Ignore any exception raised by the _user_finalize() method
                 * because it won't change anything at this point: the component
                 * is being destroyed anyway.
                 */
-               PyErr_Clear();
+               BT_COMP_LOG_CUR_LVL(BT_LOG_WARNING, log_level, self_comp,
+                       "User's _user_finalize() method raised an exception: ignoring:");
+               logw_exception_clear(get_self_message_iterator_log_level(
+                       message_iterator));
        }
 
        Py_XDECREF(py_method_result);
This page took 0.02316 seconds and 4 git commands to generate.