class LexError : std::exception { std::string myErrorMessage; public: LexError(std::string errorMessage) : myErrorMessage(errorMessage) {}; virtual const char* what() const throw() { return myErrorMessage.c_str(); } ~LexError() throw() {}; };