2#include "tool/ioprint.h"
3#include "tool/iotext.h"
31 const char*
what() const noexcept
override
38#define TINKER_THROW(msg) \
41 std::string ms_ = msg; \
42 std::string m_ = format("%s at %s:%d", ms_, __FILE__, __LINE__); \
43 throw FatalError(m_); \
46#define TINKER_ALWAYS_CHECK_RT_1_(call) \
52 std::string msg_ = translateErrorCode(res_); \
54 m_ = format("Errno %d (%s) at %s:%d", res_, msg_, __FILE__, __LINE__); \
56 m_ = format("Errno %d at %s:%d", res_, __FILE__, __LINE__); \
57 throw FatalError(m_); \
60#define TINKER_ALWAYS_CHECK_RT_(...) TINKER_GET_2ND_ARG(__VA_ARGS__, TINKER_ALWAYS_CHECK_RT_1_)
64#ifndef TINKER_ALWAYS_CHECK_RT
65#define TINKER_ALWAYS_CHECK_RT 0
73#if TINKER_DEBUG || TINKER_ALWAYS_CHECK_RT
74#define check_rt(...) TINKER_ALWAYS_CHECK_RT_(__VA_ARGS__)(__VA_ARGS__)
76#define check_rt(call, ...) call
81#define always_check_rt(...) TINKER_ALWAYS_CHECK_RT_(__VA_ARGS__)(__VA_ARGS__)
FatalError(const FatalError &e)
Definition: error.h:28
FatalError(const std::string &msg)
Definition: error.h:25
const char * what() const noexcept override
Definition: error.h:31
FatalError(const char *msg)
Definition: error.h:22
Errors and exceptions that we do not intend to fix or handle.
Definition: error.h:17
void printError()
Writes the current coordinates to a disk file prior to aborting on a serious error.
std::string translateErrorCode(T errcode)
Translates the error code to text.
void printBacktrace(std::FILE *out=stderr)
Prints the call stack to a FILE pointer.