B15F
Board 15 Famulus Edition
usartexception.h
1 #ifndef USARTEXCEPTION_H
2 #define USARTEXCEPTION_H
3 
4 #include <exception>
5 #include <string>
6 
7 // SOURCE: https://stackoverflow.com/a/8152888
8 
11 class USARTException: public std::exception
12 {
13 public:
18  explicit USARTException(const char* message) : msg(message)
19  {
20  }
21 
26  explicit USARTException(const std::string& message) : msg(message)
27  {
28  }
29 
33  virtual ~USARTException() = default;
34 
39  virtual const char* what() const throw ()
40  {
41  return msg.c_str();
42  }
43 
44 protected:
45  std::string msg;
46 };
47 
48 #endif // USARTEXCEPTION_H
USARTException::USARTException
USARTException(const char *message)
Definition: usartexception.h:18
USARTException
Definition: usartexception.h:11
USARTException::what
virtual const char * what() const
Definition: usartexception.h:39
USARTException::msg
std::string msg
failure description
Definition: usartexception.h:45
USARTException::USARTException
USARTException(const std::string &message)
Definition: usartexception.h:26
USARTException::~USARTException
virtual ~USARTException()=default