OGS
Error.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <cstdlib>
14
15#include "Logging.h"
16
17#ifdef OGS_FATAL_ABORT
18#define OGS_FATAL(...) \
19 { \
20 BaseLib::console->critical("{}:{} {}() ", __FILE__, __LINE__, \
21 __FUNCTION__, fmt::format(__VA_ARGS__)); \
22 std::abort(); \
23 }
24#else // OGS_FATAL_ABORT
25#include <stdexcept>
26#define OGS_FATAL(...) \
27 { \
28 auto const formatted_va_args = fmt::format(__VA_ARGS__); \
29 BaseLib::console->critical("{}:{} {}() ", __FILE__, __LINE__, \
30 __FUNCTION__, formatted_va_args); \
31 throw std::runtime_error(formatted_va_args); \
32 }
33#endif // OGS_FATAL_ABORT