-
Notifications
You must be signed in to change notification settings - Fork 0
callstack_exception.hpp
This header defines an exception capable to print its construction stacktrace using the CallstackLibrary.
The namespace all C++ classes of this library can be found in.
This class defines an exception capable to create and print the callstack where it initially has been constructed - usually where it was thrown.
Note
Added in version 1.1.
explicit exception(const bool printStacktrace = true)
LCS_NOEXCEPT
Trivial default constructor. The passed boolean value indicates whether to automatically append the stacktrace to the exception message.
explicit exception(const char* message, const bool printStacktrace = true)
LCS_NOEXCEPT
Constructs an exception with the given message. The passed boolean value indicates whether to automatically append the stacktrace to the exception message.
The passed message is copied.
explicit exception(const std::string& message, const bool printStacktrace = true)
LCS_NOEXCEPT
Constructs an exception with the given message. The passed boolean value indicates whether to automatically append the stacktrace to the exception message.
exception(
const exception&
other)
Trivial copy constructor.
exception(
exception&&
)
Trivial move constructor.
Only available if a compiler supporting C++11 is used.
virtual ~exception()
LCS_NOEXCEPT
Trivial virtual destructor.
virtual const char* what() const
LCS_NOEXCEPT
LCS_OVERRIDE
Returns the exception message.
If shouldPrintStacktrace
is set to true
the stacktrace of the construction of this exception object is appended
to the returned string.
Prints the stacktrace where this exception object has been constructed to the given output stream. The passed boolean value indicates whether to print the exception message as well.
void setPrintStacktrace(const bool printStacktrace)
LCS_NOEXCEPT
Sets whether to automatically append the stacktrace to the exception message.
LCS_CONSTEXPR
bool getPrintStacktrace() const
LCS_NOEXCEPT
Returns whether the stacktrace is automatically appended to the exception message.
LCS_CONSTEXPR
callstack&
getCallstack() const
LCS_NOEXCEPT
Returns the callstack object of where this exception object has been constructed.
LCS_CONSTEXPR
const std::string& getMessage() const
LCS_NOEXCEPT
Returns the message of this exception.
The message that can be optionally be thrown.
Indicates whether to automatically translate and add the callstack to the exception message.
mutable
callstack
cs
The callstack where this exception object was constructed.
The message buffer.
Copyright (C) 2022, 2024 mhahnFr.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".