Add AssertionException, specialize pprint
diff --git a/Evaluator.cpp b/Evaluator.cpp
index 56685ec..9ce5bf7 100644
--- a/Evaluator.cpp
+++ b/Evaluator.cpp
@@ -287,8 +287,7 @@
void rtError(QString brief, QString details)
{
- eout("Runtime Error: " + brief);
- eout(details);
+ throw AssertionException(brief + "\n" + details);
}
void EvalQuitException::raise() const
@@ -326,3 +325,29 @@
{
return "StackOverflowException: at " + pprint(_failedAt);
}
+
+AssertionException::AssertionException(QString message)
+ : QException()
+{
+ _message = message;
+}
+
+QString AssertionException::message() const
+{
+ return _message;
+}
+
+void AssertionException::raise() const
+{
+ throw *this;
+}
+
+AssertionException *AssertionException::clone() const
+{
+ return new AssertionException(*this);
+}
+
+AssertionException::operator QString() const
+{
+ return "AssertionException: " + _message;
+}