61static inline int errorCode(
const Err& e)
noexcept {
return static_cast<int>(e); }
75 case Err::UNKOWN_CMD:
return "Unknown command (use mmcesim -h for more information).";
77 return "Output file exists. To force overwriting, you can use option '--force' or '-f'.";
89 return "Cannot copy from include directory. Please check if directory 'include/mmcesim/copy' exists.";
94 return "Version string not specified. Assume as application version " +
_MMCESIM_VER_STR +
".";
95 default:
return "Error!";
133static inline void errorExit(
const Err& e,
bool show_error =
true) noexcept {
134 assert(
isError(e) &&
"check if it is really an error in errorExit");
138 _log.
err() << msg << std::endl;
std::ofstream & err()
Write error message to the log file.
Definition: log.h:117
static void error(const T &msg)
Print error message.
Definition: term.h:178
static bool isSuccess(const Err &e) noexcept
Check if the error code corresponds to a warning.
Definition: error_code.h:126
Err
Error Code.
Definition: error_code.h:29
@ CANNOT_OPEN_OUTPUT_FILE
@ CANNOT_COPY_FROM_INCLUDE
static bool isError(const Err &e) noexcept
Check if the error code corresponds to an error.
Definition: error_code.h:106
static bool isWarning(const Err &e) noexcept
Check if the error code corresponds to a warning.
Definition: error_code.h:115
static void errorExit(const Err &e, bool show_error=true) noexcept
Print error message and exit with exit code.
Definition: error_code.h:133
static std::string errorMsg(const Err &e) noexcept
Return the error message of the error code from class Err.
Definition: error_code.h:69
static int errorCode(const Err &e) noexcept
Return the integer of the error code from class Err.
Definition: error_code.h:61
Log _log
The shared Log variable.
Definition: log.cpp:53
Terminal Color and Style Control.