From 9a186053a690f2216b43355549c8aa7e2959583c Mon Sep 17 00:00:00 2001
From: Ferenc Szontágh <szf@fsociety.hu>
Date: Fri, 18 Apr 2025 20:53:59 +0000
Subject: [PATCH] better error reporting

---
 src/Interpreter/ConditionalStatementNode.hpp |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/Interpreter/ConditionalStatementNode.hpp b/src/Interpreter/ConditionalStatementNode.hpp
index 254f4a9..efb0730 100644
--- a/src/Interpreter/ConditionalStatementNode.hpp
+++ b/src/Interpreter/ConditionalStatementNode.hpp
@@ -4,8 +4,10 @@
  #include <vector>
  #include <memory>
  #include <string>
- #include "Interpreter/StatementNode.hpp"
- #include "Interpreter/ExpressionNode.hpp"
+#include "Interpreter/StatementNode.hpp"
+// Include for unified runtime Exception
+#include "Interpreter/Interpreter.hpp"
+#include "Interpreter/ExpressionNode.hpp"
 
  namespace Interpreter {
 
@@ -36,10 +38,9 @@
          bool cond = false;
          if (val.getType() == Symbols::Variables::Type::BOOLEAN) {
              cond = val.get<bool>();
-         } else {
-             throw std::runtime_error("Condition did not evaluate to boolean at " + filename_ +
-                                      ":" + std::to_string(line_) + "," + std::to_string(column_));
-         }
+        } else {
+            throw Exception("Condition did not evaluate to boolean", filename_, line_, column_);
+        }
          // Execute appropriate branch
          const auto & branch = cond ? thenBranch_ : elseBranch_;
          for (const auto & stmt : branch) {

--
Gitblit v1.9.3