This commit is contained in:
Andre Wagner
2026-04-29 15:36:22 -05:00
parent 30bfb38e9a
commit 03b61f4339
5 changed files with 110 additions and 0 deletions

29
src/vm/vm_exceptions.hh Normal file
View File

@@ -0,0 +1,29 @@
#ifndef TYCHE_VM_EXCEPTIONS_HH
#define TYCHE_VM_EXCEPTIONS_HH
#include <stdexcept>
#include <string>
namespace tyche {
class VMRuntimeError : public std::runtime_error
{
public:
explicit VMRuntimeError(std::string const& str) : std::runtime_error(str.c_str()) {}
};
class VMStackUnderflow : public VMRuntimeError
{
public:
explicit VMStackUnderflow() : VMRuntimeError("Stack underflow") {}
};
class VMStackOutOfRange : public VMRuntimeError
{
public:
explicit VMStackOutOfRange() : VMRuntimeError("Item does not exist in stack") {}
};
}
#endif //TYCHE_VM_EXCEPTIONS_HH