Serial-TCP/IPbridge  1.0
base_exception.h
Go to the documentation of this file.
1 
12 #ifndef BASE_EXCEPTION_H
13 #define BASE_EXCEPTION_H
14 
15 #include <string>
16 #include <exception>
17 
23 class BaseException: public std::exception {
24  public:
30  explicit BaseException(const std::string &errorMessage):
31  _errorMessage(errorMessage) {}
32 
33  // Override
34  virtual ~BaseException() throw() {}
35 
36  // Override
37  virtual const char *what() throw() { return _errorMessage.c_str(); }
38 
39  // Override
40  virtual const char *what() const throw() { return _errorMessage.c_str(); }
41 
42  private:
44  const std::string _errorMessage;
45 };
46 
47 #endif // #ifndef BASE_EXCEPTION_H
48 
49 // End of file base_exception.h
virtual ~BaseException()
Definition: base_exception.h:34
Base exception class for all project exceptions.
Definition: base_exception.h:23
virtual const char * what() const
Definition: base_exception.h:40
virtual const char * what()
Definition: base_exception.h:37
BaseException(const std::string &errorMessage)
Constructor.
Definition: base_exception.h:30
const std::string _errorMessage
Error message carried in the exception.
Definition: base_exception.h:44