Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace dexc
- {
- enum category{INFO,WARNING,CRITICAL};
- class exception : public std::exception
- {
- private:
- int code;
- category cat;
- std::string msg;
- public:
- exception(int code, category cat=INFO, std::string msg="")
- {
- this->code=code;
- this->cat=cat;
- this->msg=msg;
- }
- std::string get_catStr()
- {
- switch(cat)
- {
- case INFO:
- return "INFO";
- break;
- case WARNING:
- return "WARNING";
- break;
- case CRITICAL:
- return "CRITICAL";
- break;
- default:
- return "UNKNOWN";
- break;
- }
- }
- int get_code()
- {
- return code;
- }
- std::string what()
- {
- return msg;
- }
- category get_cat()
- {
- return cat;
- }
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement