2 * SPDX-License-Identifier: MIT
4 * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
7 #ifndef BABELTRACE_ERROR_INTERNAL_H
8 #define BABELTRACE_ERROR_INTERNAL_H
12 #include <babeltrace2/babeltrace.h>
14 struct bt_error_cause
{
15 enum bt_error_cause_actor_type actor_type
;
22 struct bt_error_cause_component_class_id
{
24 bt_component_class_type type
;
28 struct bt_error_cause_component_actor
{
29 struct bt_error_cause base
;
31 struct bt_error_cause_component_class_id comp_class_id
;
34 struct bt_error_cause_component_class_actor
{
35 struct bt_error_cause base
;
36 struct bt_error_cause_component_class_id comp_class_id
;
39 struct bt_error_cause_message_iterator_actor
{
40 struct bt_error_cause base
;
42 GString
*output_port_name
;
43 struct bt_error_cause_component_class_id comp_class_id
;
48 * Array of `struct bt_error_cause *` (or an extension); owned
55 const char *bt_error_cause_actor_type_string(
56 enum bt_error_cause_actor_type actor_type
)
59 case BT_ERROR_CAUSE_ACTOR_TYPE_UNKNOWN
:
61 case BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT
:
63 case BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT_CLASS
:
64 return "COMPONENT_CLASS";
65 case BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR
:
66 return "MESSAGE_ITERATOR";
72 struct bt_error
*bt_error_create(void);
74 void bt_error_destroy(struct bt_error
*error
);
76 __BT_ATTR_FORMAT_PRINTF(5, 0)
77 int bt_error_append_cause_from_unknown(struct bt_error
*error
,
78 const char *module_name
, const char *file_name
,
79 uint64_t line_no
, const char *msg_fmt
, va_list args
);
81 __BT_ATTR_FORMAT_PRINTF(5, 0)
82 int bt_error_append_cause_from_component(
83 struct bt_error
*error
, bt_self_component
*self_comp
,
84 const char *file_name
, uint64_t line_no
,
85 const char *msg_fmt
, va_list args
);
87 __BT_ATTR_FORMAT_PRINTF(5, 0)
88 int bt_error_append_cause_from_component_class(
89 struct bt_error
*error
,
90 bt_self_component_class
*self_comp_class
,
91 const char *file_name
, uint64_t line_no
,
92 const char *msg_fmt
, va_list args
);
94 __BT_ATTR_FORMAT_PRINTF(5, 0)
95 int bt_error_append_cause_from_message_iterator(
96 struct bt_error
*error
, bt_self_message_iterator
*self_iter
,
97 const char *file_name
, uint64_t line_no
,
98 const char *msg_fmt
, va_list args
);
100 #endif /* BABELTRACE_ERROR_INTERNAL_H */