Here is a code snippet on how to create an exception class in C++
#include <exception>
class E : public exception {
const char * msg;
E(){};
public:
E(const char * s) throw() : msg(s) {}
const char * what() const throw() { return msg; }
};