Babeltrace 2 C API 2.0.6
Open-source trace manipulation framework
Loading...
Searching...
No Matches
error-reporting.h
1#ifndef BABELTRACE2_ERROR_REPORTING_H
2#define BABELTRACE2_ERROR_REPORTING_H
3
4/*
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
29
30#include <stdarg.h>
31
32#include <babeltrace2/types.h>
33#include <babeltrace2/graph/component-class.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
450extern
452
483extern
485
505#define BT_CURRENT_THREAD_MOVE_ERROR_AND_RESET(_error) \
506 do { \
507 bt_current_thread_move_error(_error); \
508 (_error) = NULL; \
509 } while (0)
510
530extern
532
559
632extern
635 bt_self_component *self_component, const char *file_name,
636 uint64_t line_number, const char *message_format, ...);
637
648#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(_self_component, _message_format, ...) \
649 bt_current_thread_error_append_cause_from_component( \
650 (_self_component), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
651
731extern
734 bt_self_message_iterator *self_message_iterator,
735 const char *file_name, uint64_t line_number,
736 const char *message_format, ...);
737
749#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_MESSAGE_ITERATOR(_self_message_iterator, _message_format, ...) \
750 bt_current_thread_error_append_cause_from_message_iterator( \
751 (_self_message_iterator), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
752
823extern
826 bt_self_component_class *self_component_class,
827 const char *file_name, uint64_t line_number,
828 const char *message_format, ...);
829
841#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT_CLASS(_self_component_class, _message_format, ...) \
842 bt_current_thread_error_append_cause_from_component_class( \
843 (_self_component_class), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
844
887extern
890 const char *module_name, const char *file_name,
891 uint64_t line_number, const char *message_format, ...);
892
908#define BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(_module_name, _message_format, ...) \
909 bt_current_thread_error_append_cause_from_unknown( \
910 (_module_name), __FILE__, __LINE__, (_message_format), ##__VA_ARGS__)
911
932extern
933uint64_t bt_error_get_cause_count(const bt_error *error);
934
958extern
960 const bt_error *error, uint64_t index);
961
990extern
991void bt_error_release(const bt_error *error);
992
1029
1043extern
1045 const bt_error_cause *error_cause);
1046
1064extern
1065const char *bt_error_cause_get_message(const bt_error_cause *error_cause);
1066
1084extern
1085const char *bt_error_cause_get_module_name(const bt_error_cause *error_cause);
1086
1106extern
1107const char *bt_error_cause_get_file_name(const bt_error_cause *error_cause);
1108
1123extern
1125
1155extern
1157 const bt_error_cause *error_cause);
1158
1176extern
1178 const bt_error_cause *error_cause);
1179
1202extern
1204 const bt_error_cause *error_cause);
1205
1233extern
1235 const bt_error_cause *error_cause);
1236
1267extern
1269 const bt_error_cause *error_cause);
1270
1293extern
1295 const bt_error_cause *error_cause);
1296
1314extern
1317 const bt_error_cause *error_cause);
1318
1341extern
1343 const bt_error_cause *error_cause);
1344
1373extern
1375 const bt_error_cause *error_cause);
1376
1401extern
1404 const bt_error_cause *error_cause);
1405
1428extern
1430 const bt_error_cause *error_cause);
1431
1459extern
1461 const bt_error_cause *error_cause);
1462
1467#ifdef __cplusplus
1468}
1469#endif
1470
1471#endif /* BABELTRACE2_ERROR_REPORTING_H */
bt_component_class_type
Component class type enumerators.
Definition component-class.h:214
struct bt_error bt_error
Error.
Definition types.h:48
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...
const bt_error * bt_current_thread_take_error(void)
Takes the current thread's error, that is, moves its ownership from the library to the caller.
const char * bt_error_cause_get_message(const bt_error_cause *error_cause)
Returns the message of the error cause error_cause.
bt_current_thread_error_append_cause_status
Status codes for the bt_current_thread_error_append_cause_from_*() functions.
Definition error-reporting.h:546
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_...
void bt_error_release(const bt_error *error)
Releases (frees) the error error.
const char * bt_error_cause_get_module_name(const bt_error_cause *error_cause)
Returns the module name of the error cause error_cause.
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 current thread's error from a component class method.
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...
uint64_t bt_error_get_cause_count(const bt_error *error)
Returns the number of error causes contained in the error error.
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_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 current thread's error from a component method.
void bt_current_thread_clear_error(void)
Releases the current thread's error, if any.
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 ...
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...
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...
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_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...
void bt_current_thread_move_error(const bt_error *error)
Moves the ownership of the error error from the caller to the library.
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.
struct bt_error_cause bt_error_cause
Error cause.
Definition types.h:49
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...
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 current thread's error from any function.
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.
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 current thread's error from a message iterator method.
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...
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 current th...
bt_error_cause_actor_type
Error cause actor type enumerators.
Definition error-reporting.h:1004
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 curre...
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_MEMORY_ERROR
Out of memory.
Definition error-reporting.h:557
@ BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_STATUS_OK
Success.
Definition error-reporting.h:551
@ BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT
Component method.
Definition error-reporting.h:1015
@ BT_ERROR_CAUSE_ACTOR_TYPE_MESSAGE_ITERATOR
Message iterator method.
Definition error-reporting.h:1027
@ BT_ERROR_CAUSE_ACTOR_TYPE_UNKNOWN
Any function.
Definition error-reporting.h:1009
@ BT_ERROR_CAUSE_ACTOR_TYPE_COMPONENT_CLASS
Component class method.
Definition error-reporting.h:1021
struct bt_self_component_class bt_self_component_class
Self component class.
Definition types.h:86
struct bt_self_component bt_self_component
Self component.
Definition types.h:85
struct bt_self_message_iterator bt_self_message_iterator
Self message iterator.
Definition types.h:100