Babeltrace 2 C API  2.1.1
Open-source trace manipulation framework
error-reporting.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation
5  */
6 
7 /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */
8 
9 #ifndef BABELTRACE2_ERROR_REPORTING_H
10 #define BABELTRACE2_ERROR_REPORTING_H
11 
12 #ifndef __BT_IN_BABELTRACE_H
13 # error "Please include <babeltrace2/babeltrace.h> instead."
14 #endif
15 
16 #include <stdarg.h>
17 
18 #include <babeltrace2/types.h>
19 #include <babeltrace2/graph/component-class.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
438 extern
439 const bt_error *bt_current_thread_take_error(void) __BT_NOEXCEPT;
440 
471 extern
472 void bt_current_thread_move_error(const bt_error *error) __BT_NOEXCEPT;
473 
493 #define BT_CURRENT_THREAD_MOVE_ERROR_AND_RESET(_error) \
494  do { \
495  bt_current_thread_move_error(_error); \
496  (_error) = NULL; \
497  } while (0)
498 
518 extern
519 void bt_current_thread_clear_error(void) __BT_NOEXCEPT;
520 
540 
547 
620 extern __BT_ATTR_FORMAT_PRINTF(4, 5)
623  bt_self_component *self_component, const char *file_name,
624  uint64_t line_number,
625  const char *message_format, ...) __BT_NOEXCEPT;
626 
637 #define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(_self_component, _message_format, ...) \
638  bt_current_thread_error_append_cause_from_component( \
639  (_self_component), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
640 
720 extern __BT_ATTR_FORMAT_PRINTF(4, 5)
723  bt_self_message_iterator *self_message_iterator,
724  const char *file_name, uint64_t line_number,
725  const char *message_format, ...) __BT_NOEXCEPT;
726 
738 #define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_MESSAGE_ITERATOR(_self_message_iterator, _message_format, ...) \
739  bt_current_thread_error_append_cause_from_message_iterator( \
740  (_self_message_iterator), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
741 
812 extern __BT_ATTR_FORMAT_PRINTF(4, 5)
815  bt_self_component_class *self_component_class,
816  const char *file_name, uint64_t line_number,
817  const char *message_format, ...) __BT_NOEXCEPT;
818 
830 #define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT_CLASS(_self_component_class, _message_format, ...) \
831  bt_current_thread_error_append_cause_from_component_class( \
832  (_self_component_class), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
833 
876 extern __BT_ATTR_FORMAT_PRINTF(4, 5)
879  const char *module_name, const char *file_name,
880  uint64_t line_number,
881  const char *message_format, ...) __BT_NOEXCEPT;
882 
898 #define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(_module_name, _message_format, ...) \
899  bt_current_thread_error_append_cause_from_unknown( \
900  (_module_name), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
901 
922 extern
923 uint64_t bt_error_get_cause_count(const bt_error *error) __BT_NOEXCEPT;
924 
948 extern
950  const bt_error *error, uint64_t index) __BT_NOEXCEPT;
951 
980 extern
981 void bt_error_release(const bt_error *error) __BT_NOEXCEPT;
982 
1000 
1006 
1012 
1019 
1033 extern
1035  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1036 
1054 extern
1055 const char *bt_error_cause_get_message(
1056  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1057 
1075 extern
1076 const char *bt_error_cause_get_module_name(
1077  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1078 
1098 extern
1099 const char *bt_error_cause_get_file_name(
1100  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1101 
1116 extern
1118  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1119 
1149 extern
1151  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1152 
1170 extern
1172  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1173 
1196 extern
1198  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1199 
1227 extern
1229  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1230 
1261 extern
1263  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1264 
1287 extern
1289  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1290 
1308 extern
1311  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1312 
1335 extern
1337  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1338 
1367 extern
1369  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1370 
1395 extern
1398  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1399 
1422 extern
1424  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1425 
1453 extern
1455  const bt_error_cause *error_cause) __BT_NOEXCEPT;
1456 
1461 #ifdef __cplusplus
1462 }
1463 #endif
1464 
1465 #endif /* BABELTRACE2_ERROR_REPORTING_H */
bt_error_cause_actor_type bt_error_cause_get_actor_type(const bt_error_cause *error_cause)
Returns the actor type enumerator of the error cause error_cause.
uint64_t bt_error_cause_get_line_number(const bt_error_cause *error_cause)
Returns the line number of the statement which appended the error cause error_cause to the error of t...
const char * bt_error_cause_message_iterator_actor_get_plugin_name(const bt_error_cause *error_cause)
Returns the name of the plugin which provides the class of the component of which a message iterator ...
const char * bt_error_cause_get_module_name(const bt_error_cause *error_cause)
Returns the module name of the error cause error_cause.
const char * bt_error_cause_component_class_actor_get_plugin_name(const bt_error_cause *error_cause)
Returns the name of the plugin which provides the component class of which a method appended the erro...
struct bt_self_message_iterator bt_self_message_iterator
Self message iterator.
Definition: types.h:86
const char * bt_error_cause_component_actor_get_component_name(const bt_error_cause *error_cause)
Returns the name of the component of which a method appended the error cause error_cause to the error...
struct bt_self_component bt_self_component
Self component.
Definition: types.h:71
Component class method.
Definition: error-reporting.h:1011
const char * bt_error_cause_component_actor_get_plugin_name(const bt_error_cause *error_cause)
Returns the name of the plugin which provides the class of the component of which a method appended t...
const char * bt_error_cause_component_actor_get_component_class_name(const bt_error_cause *error_cause)
Returns the class name of the component of which a method appended the error cause error_cause to the...
bt_error_cause_actor_type
Error cause actor type enumerators.
Definition: error-reporting.h:994
Any function.
Definition: error-reporting.h:999
bt_current_thread_error_append_cause_status bt_current_thread_error_append_cause_from_message_iterator(bt_self_message_iterator *self_message_iterator, const char *file_name, uint64_t line_number, const char *message_format,...)
Appends an error cause to the error of the current thread from a message iterator method...
bt_component_class_type
Component class type enumerators.
Definition: component-class.h:202
Component method.
Definition: error-reporting.h:1005
const char * bt_error_cause_get_message(const bt_error_cause *error_cause)
Returns the message of the error cause error_cause.
void bt_error_release(const bt_error *error)
Releases (frees) the error error.
const char * bt_error_cause_message_iterator_actor_get_component_output_port_name(const bt_error_cause *error_cause)
Returns the name of the output port from which was created the message iterator of which the method a...
struct bt_error bt_error
Error.
Definition: types.h:34
void bt_current_thread_move_error(const bt_error *error)
Moves the ownership of the error error from the caller to the library.
void bt_current_thread_clear_error(void)
Releases the error of the current thread, if any.
const char * bt_error_cause_message_iterator_actor_get_component_class_name(const bt_error_cause *error_cause)
Returns the class name of the component of which a message iterator method appended the error cause e...
const char * bt_error_cause_component_class_actor_get_component_class_name(const bt_error_cause *error_cause)
Returns the name of the component class of which a method appended the error cause error_cause to the...
Message iterator method.
Definition: error-reporting.h:1017
uint64_t bt_error_get_cause_count(const bt_error *error)
Returns the number of error causes contained in the error error.
bt_current_thread_error_append_cause_status bt_current_thread_error_append_cause_from_component_class(bt_self_component_class *self_component_class, const char *file_name, uint64_t line_number, const char *message_format,...)
Appends an error cause to the error of the current thread from a component class method.
bt_component_class_type bt_error_cause_message_iterator_actor_get_component_class_type(const bt_error_cause *error_cause)
Returns the class type of the component of which a message iterator method appended the error cause e...
bt_component_class_type bt_error_cause_component_class_actor_get_component_class_type(const bt_error_cause *error_cause)
Returns the name of the component class of which a method appended the error cause error_cause to the...
bt_current_thread_error_append_cause_status
Status codes for the bt_current_thread_error_append_cause_from_*() functions.
Definition: error-reporting.h:534
const bt_error * bt_current_thread_take_error(void)
Takes the error of the current thread, that is, moves its ownership from the library to the caller...
Success.
Definition: error-reporting.h:539
Out of memory.
Definition: error-reporting.h:545
const bt_error_cause * bt_error_borrow_cause_by_index(const bt_error *error, uint64_t index)
Borrows the error cause at index index from the error error.
const char * bt_error_cause_get_file_name(const bt_error_cause *error_cause)
Returns the name of the source file which contains the function which appended the error cause error_...
bt_current_thread_error_append_cause_status bt_current_thread_error_append_cause_from_component(bt_self_component *self_component, const char *file_name, uint64_t line_number, const char *message_format,...)
Appends an error cause to the error of the current thread from a component method.
struct bt_self_component_class bt_self_component_class
Self component class.
Definition: types.h:72
struct bt_error_cause bt_error_cause
Error cause.
Definition: types.h:35
bt_current_thread_error_append_cause_status bt_current_thread_error_append_cause_from_unknown(const char *module_name, const char *file_name, uint64_t line_number, const char *message_format,...)
Appends an error cause to the error of the current thread from any function.
const char * bt_error_cause_message_iterator_actor_get_component_name(const bt_error_cause *error_cause)
Returns the name of the component of which a message iterator method appended the error cause error_c...
bt_component_class_type bt_error_cause_component_actor_get_component_class_type(const bt_error_cause *error_cause)
Returns the class type of the component of which a method appended the error cause error_cause to the...