mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-21 22:55:11 +00:00
Finishing the first opcode
This commit is contained in:
28
sources/Exceptions/InvalidOpcode.hpp
Normal file
28
sources/Exceptions/InvalidOpcode.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 1/30/20.
|
||||
//
|
||||
|
||||
#ifndef COMSQUARE_INVALIDACTION_HPP
|
||||
#define COMSQUARE_INVALIDACTION_HPP
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <ios>
|
||||
|
||||
namespace ComSquare
|
||||
{
|
||||
//! @brief Exception thrown when someone tries to load an invalid rom.
|
||||
class InvalidOpcode : std::exception {
|
||||
private:
|
||||
std::string _msg;
|
||||
public:
|
||||
explicit InvalidOpcode(const std::string &pu, unsigned opcode)
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << "The " + pu + ": 0x" << std::hex << opcode;
|
||||
this->_msg = stream.str();
|
||||
}
|
||||
const char *what() const noexcept override { return this->_msg.c_str(); }
|
||||
};
|
||||
}
|
||||
#endif //COMSQUARE_INVALIDACTION_HPP
|
||||
Reference in New Issue
Block a user