8#include <AH/Debug/Debug.hpp>
22#define ERROR(msg, errc) \
25 DEBUGFN(msg << " (0x" << hex << uppercase << errc << dec \
26 << nouppercase << ')'); \
42#define ERROR(msg, errc) \
44 DEBUGFN(msg << " (0x" << hex << uppercase << errc << dec \
45 << nouppercase << ')'); \
60#define FATAL_ERROR(msg, errc) \
63 DEBUGFN(F("Fatal Error: ") << msg << " (0x" << hex << uppercase \
64 << errc << dec << nouppercase << ')'); \
75class ErrorException :
public std::exception {
77 ErrorException(
const std::string message,
int errorCode)
78 : message(std::move(message)), errorCode(errorCode) {}
79 const char *what()
const throw()
override {
return message.c_str(); }
80 int getErrorCode()
const {
return errorCode; }
83 const std::string message;
89#define ERROR(msg, errc) \
92 std::ostringstream s; \
93 s << DEBUG_FUNC_LOCATION << msg; \
94 throw ErrorException(s.str(), errc); \
97#define FATAL_ERROR(msg, errc) \
100 std::ostringstream s; \
101 s << DEBUG_FUNC_LOCATION << msg; \
102 throw ErrorException(s.str(), errc); \
void fatalErrorExit() __attribute__((noreturn))
Function that executes and loops forever, blinking the built-in LED when a fatal error is encountered...
#define BEGIN_AH_NAMESPACE
#define AH_DIAGNOSTIC_POP()
#define AH_DIAGNOSTIC_WERROR()