1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-25 13:55:47 -05:00
polybar/include/exception.hpp

17 lines
512 B
C++
Raw Normal View History

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