- gstr = bt_py_common_format_exception(py_exc_type, py_exc_value,
- py_exc_tb, active_log_level, false);
- if (!gstr) {
- /* bt_py_common_format_exception has already warned. */
- goto end;
+ py_bt_error_msg = PyObject_GetAttrString(py_exc_value, "_msg");
+ BT_ASSERT(py_bt_error_msg);
+
+ g_string_append_printf(gstr, "\nbt2._Error: %s",
+ PyUnicode_AsUTF8(py_bt_error_msg));
+ } else {
+ py_exc_type = PyObject_Type(py_exc_value);
+
+ gstr = bt_py_common_format_exception(py_exc_type, py_exc_value,
+ py_exc_tb, active_log_level, false);
+ if (!gstr) {
+ /* bt_py_common_format_exception has already warned. */
+ goto end;
+ }