Wyatt  1.0.1
MismatchedMessageException.h
1 //
2 // Created by Tucker Haydon on 4/26/17.
3 //
4 
5 #pragma once
6 
7 #include "messages/IMessage.h"
8 #include <typeinfo>
9 
13 class MismatchedMessageException: public std::exception {
14 
15 public:
20  MismatchedMessageException(IMessage* msg): std::exception() {
21  this->msg = msg;
22  }
23 
28  virtual const char* what() const throw() {
29  std::string msg("Message is of wrong type: ");
30  msg += typeid(this->msg).name();
31  return msg.c_str();
32  }
33 
34 private:
35  IMessage* msg;
36 };
virtual const char * what() const