63 template <
class Exception>
65 std::lock_guard<std::mutex> guard(exceptionMutex);
87 template <
typename First,
typename... Args>
88 static void exception(fmt::format_string<First, Args...> exceptionString, First &&first, Args &&...args);
105 static std::mutex exceptionMutex;
107 static std::function<void()> _customAbortFunction;
109 static void nonThrowException(
const std::exception &e);
136 [[nodiscard]]
const char *
what() const noexcept override;
139 std::
string _description;
157template <typename First, typename... Args>
159 std::string s = fmt::format(exceptionString, std::forward<First>(first), std::forward<Args>(args)...);
Default exception class for autopas exceptions.
Definition: ExceptionHandler.h:116
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:46
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:64
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:22
@ printCustomAbortFunction
Print the exception and call a custom abort function.
Definition: ExceptionHandler.h:38
@ ignore
Ignore all exceptions.
Definition: ExceptionHandler.h:26
@ printAbort
Print the exception and.
Definition: ExceptionHandler.h:34
@ throwException
Throw the exception.
Definition: ExceptionHandler.h:30