1#ifndef DUNE_COPASI_COMMON_EXCEPTION_HH
2#define DUNE_COPASI_COMMON_EXCEPTION_HH
4#include <dune-copasi-config.hh>
6#include <dune/common/classname.hh>
11#if __has_include(<stacktrace>)
15#if __has_include(<format>)
21template<
typename Exception,
typename... Args>
22[[nodiscard]]
inline auto
25 auto message = std::string{
"Message: "};
26 message += fmt::format(std::move(format), std::forward<Args>(args)...);
27 message += fmt::format(
"\nException type: {}", className<Exception>());
28#if ___cpp_lib_stacktrace >= 202011L && __cpp_lib_formatters >= 202302L
29 message += std::format(
"\nStacktrace:\n{}", std::stacktrace::current());
32 return std::forward<Exception>(e);
Definition: axis_names.hh:7
auto format_exception(Exception &&e, fmt::format_string< Args... > format, Args &&... args)
Definition: exceptions.hh:23