ComSquare
InvalidOpcode.hpp
Go to the documentation of this file.
1 //
2 // Created by anonymus-raccoon on 1/30/20.
3 //
4 
5 #ifndef COMSQUARE_INVALIDACTION_HPP
6 #define COMSQUARE_INVALIDACTION_HPP
7 
8 #include <exception>
9 #include <string>
10 #include <sstream>
11 #include "DebuggableError.hpp"
12 
13 namespace ComSquare
14 {
16  class InvalidOpcode : public DebuggableError {
17  private:
18  std::string _msg;
19  public:
20  explicit InvalidOpcode(const std::string &what)
21  {
22  this->_msg = what;
23  }
24 
25  explicit InvalidOpcode(const std::string &pu, unsigned opcode)
26  {
27  std::stringstream stream;
28  stream << "The " + pu + " got an invalid opcode: 0x" << std::hex << opcode;
29  this->_msg = stream.str();
30  }
31  const char *what() const noexcept override { return this->_msg.c_str(); }
32  };
33 }
34 #endif //COMSQUARE_INVALIDACTION_HPP
ComSquare::InvalidOpcode
Exception thrown when someone tries to load an invalid rom.
Definition: InvalidOpcode.hpp:16
ComSquare::InvalidOpcode::InvalidOpcode
InvalidOpcode(const std::string &pu, unsigned opcode)
Definition: InvalidOpcode.hpp:25
ComSquare::InvalidOpcode::InvalidOpcode
InvalidOpcode(const std::string &what)
Definition: InvalidOpcode.hpp:20
ComSquare::InvalidOpcode::what
const char * what() const noexcept override
Definition: InvalidOpcode.hpp:31
DebuggableError.hpp
ComSquare::InvalidOpcode::_msg
std::string _msg
Definition: InvalidOpcode.hpp:18
ComSquare::DebuggableError
Definition: DebuggableError.hpp:11
ComSquare
Definition: APU.cpp:12