Improve runtime error handling

This commit is contained in:
2020-05-16 11:54:49 +02:00
parent 41fb08373c
commit 30252e5863
4 changed files with 77 additions and 10 deletions

View File

@@ -2,5 +2,43 @@
namespace Execute
{
std::string const & RuntimeError::GetMessage() const
{
return message;
}
RuntimeError::RuntimeError()
: message("Undocumented runtime error")
{
}
RuntimeError::RuntimeError(std::string const & what)
: message(what)
{
}
StackUnderflow::StackUnderflow()
: RuntimeError("Stack underflow error")
{
}
StackOverflow::StackOverflow()
: RuntimeError("Stack overflow error")
{
}
MissingLabel::MissingLabel(std::string const & label)
{
message = "Missing jump/function label \"";
message += label;
message += '"';
}
namespace Internal
{
BadValueType::BadValueType()
: RuntimeError("Internal error: bad value type")
{
}
}
}