22 #ifndef __M2ETIS_UTIL_EXCEPTIONS_H__
23 #define __M2ETIS_UTIL_EXCEPTIONS_H__
28 #include "boost/exception/all.hpp"
33 #define M2ETIS_THROW_FAILURE(module, message, errorcode) {\
34 throw m2etis::util::SystemFailureException(module, message, __FILE__, __LINE__, errorcode);\
40 #define M2ETIS_THROW_API(module, message) {\
41 throw m2etis::util::ApiException(module, message, __FILE__, __LINE__);\
60 : level(l), message(msg), module(m), file(f), line(li), errorcode(-1) {
63 loginfo(
const log::LogLevel l,
const std::string msg,
const std::string m,
const std::string f,
int li,
int errcode)
64 : level(l), message(msg), module(m), file(f), line(li), errorcode(errcode) {
68 typedef boost::error_info<struct tag_logmessage, loginfo>
excinfo_log;
76 struct m2exception :
virtual boost::exception,
virtual std::exception {
113 M2ETIS_API SystemFailureException(
const std::string & logmodule,
const std::string & logmsg,
const std::string & file,
const int line,
const int errorcode);
124 M2ETIS_API ApiException(
const std::string & logmodule,
const std::string & logmsg,
const std::string & file,
const int line);
Occurs when the engine detects a programmer's error.
M2ETIS_API m2exception(const util::log::LogLevel loglevel, const std::string &logmodule, const std::string &logmsg, const std::string &file, int line)
LogLevel
Defines values to specify severity/importance of log message.
loginfo(const log::LogLevel l, const std::string msg, const std::string m, const std::string f, int li)
virtual M2ETIS_API const char * what() const
Overrides std::exception method to output message to console.
M2ETIS_API ApiException(const std::string &logmodule, const std::string &logmsg, const std::string &file, const int line)
M2ETIS_API void PassToMain()
writes the error message to the ExceptionQueue
boost::error_info< struct tag_logmessage, loginfo > excinfo_log
Internal data structure for exceptions.
util::log::LogLevel level
M2ETIS_API int getErrorcode()
Returns the exception's errorcode or -1 if no errorcode is present.
loginfo(const log::LogLevel l, const std::string msg, const std::string m, const std::string f, int li, int errcode)
Critical exception that cannot be repaired by a single subsystem.
M2ETIS_API SystemFailureException(const std::string &logmodule, const std::string &logmsg, const std::string &file, const int line, const int errorcode)
M2ETIS_API void writeLog()
Writes the exception's logmessage.