#include <babeltrace2/babeltrace.h>
#include "error.h"
-#include "graph/message/iterator.h"
#include "graph/component.h"
#include "graph/component-class.h"
+#include "graph/iterator.h"
#include "common/assert.h"
+#include "common/common.h"
#include "lib/assert-cond.h"
#include "lib/func-status.h"
goto end;
}
- BT_LIB_LOGD("Initialized error cause: %!+r", cause);
-
end:
return ret;
}
return cause;
}
-BT_HIDDEN
struct bt_error *bt_error_create(void)
{
struct bt_error *error;
return error;
}
-BT_HIDDEN
void bt_error_destroy(struct bt_error *error)
{
if (!error) {
return;
}
-BT_HIDDEN
int bt_error_append_cause_from_unknown(struct bt_error *error,
const char *module_name, const char *file_name,
uint64_t line_no, const char *msg_fmt, va_list args)
cause = NULL;
end:
- destroy_error_cause(cause);
return status;
}
-BT_HIDDEN
int bt_error_append_cause_from_component(
struct bt_error *error, bt_self_component *self_comp,
const char *file_name, uint64_t line_no,
cause = NULL;
end:
- if (cause) {
- destroy_error_cause(&cause->base);
- }
-
return status;
}
-BT_HIDDEN
int bt_error_append_cause_from_component_class(
struct bt_error *error,
bt_self_component_class *self_comp_class,
cause = NULL;
end:
- if (cause) {
- destroy_error_cause(&cause->base);
- }
-
return status;
}
-BT_HIDDEN
int bt_error_append_cause_from_message_iterator(
struct bt_error *error, bt_self_message_iterator *self_iter,
const char *file_name, uint64_t line_no,
cause = NULL;
end:
- if (cause) {
- destroy_error_cause(&cause->base);
- }
-
return status;
}
return error->causes ? error->causes->len : 0;
}
+BT_EXPORT
uint64_t bt_error_get_cause_count(const bt_error *error)
{
BT_ASSERT_PRE_ERROR_NON_NULL(error);
return error_cause_count(error);
}
+BT_EXPORT
void bt_error_release(const struct bt_error *error)
{
BT_ASSERT_PRE_ERROR_NON_NULL(error);
bt_error_destroy((void *) error);
}
+BT_EXPORT
const struct bt_error_cause *bt_error_borrow_cause_by_index(
const bt_error *error, uint64_t index)
{
return error->causes->pdata[index];
}
+BT_EXPORT
enum bt_error_cause_actor_type bt_error_cause_get_actor_type(
const struct bt_error_cause *cause)
{
return cause->actor_type;
}
+BT_EXPORT
const char *bt_error_cause_get_message(const struct bt_error_cause *cause)
{
BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause);
return cause->message->str;
}
+BT_EXPORT
const char *bt_error_cause_get_module_name(const struct bt_error_cause *cause)
{
BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause);
return cause->module_name->str;
}
+BT_EXPORT
const char *bt_error_cause_get_file_name(const struct bt_error_cause *cause)
{
BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause);
return cause->file_name->str;
}
+BT_EXPORT
uint64_t bt_error_cause_get_line_number(const bt_error_cause *cause)
{
BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(cause);
return cause->line_no;
}
+BT_EXPORT
const char *bt_error_cause_component_actor_get_component_name(
const struct bt_error_cause *cause)
{
return spec_cause->comp_name->str;
}
+BT_EXPORT
bt_component_class_type bt_error_cause_component_actor_get_component_class_type(
const struct bt_error_cause *cause)
{
return spec_cause->comp_class_id.type;
}
+BT_EXPORT
const char *bt_error_cause_component_actor_get_component_class_name(
const struct bt_error_cause *cause)
{
return spec_cause->comp_class_id.name->str;
}
+BT_EXPORT
const char *bt_error_cause_component_actor_get_plugin_name(
const struct bt_error_cause *cause)
{
spec_cause->comp_class_id.plugin_name->str : NULL;
}
+BT_EXPORT
bt_component_class_type
bt_error_cause_component_class_actor_get_component_class_type(
const struct bt_error_cause *cause)
return spec_cause->comp_class_id.type;
}
+BT_EXPORT
const char *bt_error_cause_component_class_actor_get_component_class_name(
const struct bt_error_cause *cause)
{
return spec_cause->comp_class_id.name->str;
}
+BT_EXPORT
const char *bt_error_cause_component_class_actor_get_plugin_name(
const struct bt_error_cause *cause)
{
spec_cause->comp_class_id.plugin_name->str : NULL;
}
+BT_EXPORT
const char *bt_error_cause_message_iterator_actor_get_component_name(
const struct bt_error_cause *cause)
{
return spec_cause->comp_name->str;
}
+BT_EXPORT
const char *
bt_error_cause_message_iterator_actor_get_component_output_port_name(
const struct bt_error_cause *cause)
return spec_cause->output_port_name->str;
}
+BT_EXPORT
bt_component_class_type
bt_error_cause_message_iterator_actor_get_component_class_type(
const struct bt_error_cause *cause)
return spec_cause->comp_class_id.type;
}
+BT_EXPORT
const char *bt_error_cause_message_iterator_actor_get_component_class_name(
const struct bt_error_cause *cause)
{
return spec_cause->comp_class_id.name->str;
}
+BT_EXPORT
const char *bt_error_cause_message_iterator_actor_get_plugin_name(
const struct bt_error_cause *cause)
{