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  BaseLib::console->critical("{}:{} {}() ", __FILE__, __LINE__, \
29  __FUNCTION__, fmt::format(__VA_ARGS__)); \
30  throw std::runtime_error(fmt::format(__VA_ARGS__)); \
31  }
32 #endif // OGS_FATAL_ABORT