cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_error.i.h
CommitLineData
5038e256 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
5038e256
SM
3 *
4 * Copyright (c) 2019 Efficios, Inc.
5038e256
SM
5 */
6
7#include <string-format/format-error.h>
8
9static
10PyObject *bt_bt2_format_bt_error_cause(const bt_error_cause *error_cause)
11{
12 gchar *error_cause_str;
13 PyObject *py_error_cause_str = NULL;
14
15 error_cause_str = format_bt_error_cause(error_cause, 80,
71436ae4
SM
16 (bt_logging_level) bt_python_bindings_bt2_log_level,
17 BT_COMMON_COLOR_WHEN_NEVER);
5038e256
SM
18 BT_ASSERT(error_cause_str);
19
20 py_error_cause_str = PyString_FromString(error_cause_str);
21
22 g_free(error_cause_str);
23
24 return py_error_cause_str;
25}
26
27static
28PyObject *bt_bt2_format_bt_error(const bt_error *error)
29{
30 gchar *error_str;
31 PyObject *py_error_str = NULL;
32
33 error_str = format_bt_error(error, 80,
71436ae4
SM
34 (bt_logging_level) bt_python_bindings_bt2_log_level,
35 BT_COMMON_COLOR_WHEN_NEVER);
5038e256
SM
36 BT_ASSERT(error_str);
37
38 py_error_str = PyString_FromString(error_str);
39
40 g_free(error_str);
41
42 return py_error_str;
43}
This page took 0.076272 seconds and 4 git commands to generate.