24 #ifndef _CORE_EXCEPTION_H_
25 #define _CORE_EXCEPTION_H_
38 Exception(
const char *format, ...) noexcept;
39 Exception(
int errnoval,
const char *format, ...) noexcept;
44 void prepend(
const char *format, ...) noexcept;
45 void append(
const char *format, ...) noexcept;
46 void append_va(
const char *format, va_list va) noexcept;
57 virtual const char *
what()
const noexcept;
116 const
char *type_id_;
Message iterator for exceptions.
iterator()
Plain constructor.
bool operator!=(const iterator &i) const
Check inequality.
const char * operator*() const
Get current message.
iterator & operator++()
Prefix ++ operator.
bool operator==(const iterator &i) const
Check equality.
iterator & operator=(const iterator &i)
Assignment operator.
Base class for exceptions in Fawkes.
void print_trace() noexcept
Prints trace to stderr.
virtual const char * what() const noexcept
Get primary string.
Mutex * messages_mutex
Mutex to protect operations on messages list.
iterator end() noexcept
Get end iterator for messages.
message_list_t * messages_end
Pointer that points to the very last message.
message_list_t * messages
List of messages.
virtual const char * what_no_backtrace() const noexcept
Get primary string (does not implicitly print the back trace).
void prepend_nolock_va(const char *format, va_list va) noexcept
Prepend messages without lock by formatted string.
void copy_messages(const Exception &exc) noexcept
Copy messages from given exception.
void prepend(const char *format,...) noexcept
Prepend messages to the message list.
void set_type_id(const char *id)
Set exception type ID.
void print_backtrace() const noexcept
Prints a backtrace.
void append_va(const char *format, va_list va) noexcept
Append messages to the message list.
void append(const char *format,...) noexcept
Append messages to the message list.
int get_errno() noexcept
Get errno.
void append_nolock(const char *format,...) noexcept
Append messages without lock.
void append_nolock_va(const char *format, va_list va) noexcept
Append messages without lock by formatted string.
Exception() noexcept
Constructor for subclasses.
void append_nolock_nocopy(char *msg) noexcept
Append message without copying.
message_list_t * messages_iterator
Iterator to iterate over messages.
int _errno
Error number, should be used if the error was caused by a method that supplies errno.
const char * type_id() const
Get type ID.
Exception & operator=(const Exception &exc) noexcept
Assign an Exception.
iterator begin() noexcept
Get iterator for messages.
virtual ~Exception() noexcept
Destructor.
char * generate_backtrace() const noexcept
Generate backtrace string.
Mutex mutual exclusion lock.
Fawkes library namespace.
Internal exception message list.
message_list_t * next
pointer to next element, NULL if last element
char * msg
pointer to message, may not be NULL, will be freed in dtor