62 template <
class Exception>
64 std::lock_guard<std::mutex> guard(exceptionMutex);
86 template <
typename First,
typename... Args>
87 static void exception(std::string exceptionString, First first, Args... args);
104 static std::mutex exceptionMutex;
106 static std::function<void()> _customAbortFunction;
108 static void nonThrowException(
const std::exception &e);
135 [[nodiscard]]
const char *
what() const noexcept override;
138 std::
string _description;
156template <typename First, typename... Args>
158 std::string s = fmt::format(exceptionString, first, args...);
Default exception class for autopas exceptions.
Definition: ExceptionHandler.h:115
AutoPasException(const AutoPasException &exception)
Copy constructor.
const char * what() const noexcept override
returns the description
Definition: ExceptionHandler.cpp:87
Defines and handles the throwing and printing of exceptions.
Definition: ExceptionHandler.h:45
static void setCustomAbortFunction(std::function< void()> function)
Set a custom abort function.
Definition: ExceptionHandler.cpp:50
static void rethrow()
Rethrows the current exception or prints it.
Definition: ExceptionHandler.cpp:27
static void setBehavior(ExceptionBehavior behavior)
Set the behavior of the handler.
Definition: ExceptionHandler.cpp:45
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63
In this namespace some helper classes and functions can be found used inside of AutoPas.
Definition: namespaces.h:44
ExceptionBehavior
Enum that defines the behavior of the expection handling.
Definition: ExceptionHandler.h:21
@ printCustomAbortFunction
Print the exception and call a custom abort function.
Definition: ExceptionHandler.h:37
@ ignore
Ignore all exceptions.
Definition: ExceptionHandler.h:25
@ printAbort
Print the exception and.
Definition: ExceptionHandler.h:33
@ throwException
Throw the exception.
Definition: ExceptionHandler.h:29