2016-05-31 03:58:58 +00:00
|
|
|
#pragma once
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
struct Exception : public std::runtime_error
|
|
|
|
{
|
2016-05-31 03:58:58 +00:00
|
|
|
explicit Exception(const std::string& error_message = "")
|
2016-05-19 14:41:06 +00:00
|
|
|
: std::runtime_error(error_message.c_str()) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DefineChildException(ExName, ParentEx) struct ExName : public ParentEx { \
|
2016-05-31 03:58:58 +00:00
|
|
|
explicit ExName(const std::string& error_message = "") \
|
2016-05-19 14:41:06 +00:00
|
|
|
: ParentEx("["+ std::string(__FUNCTION__) +"] => "+ error_message) {} \
|
2016-05-24 02:00:43 +00:00
|
|
|
}
|
|
|
|
#define DefineBaseException(ExName) DefineChildException(ExName, Exception)
|