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/ForStatementNode.hpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Interpreter/ForStatementNode.hpp b/src/Interpreter/ForStatementNode.hpp
index 6d33723..0a1092e 100644
--- a/src/Interpreter/ForStatementNode.hpp
+++ b/src/Interpreter/ForStatementNode.hpp
@@ -5,8 +5,10 @@
  #include <memory>
  #include <string>
  #include <stdexcept>
- #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"
  #include "Symbols/Value.hpp"
  #include "Symbols/SymbolContainer.hpp"
  #include "Symbols/SymbolFactory.hpp"
@@ -45,8 +47,7 @@
         // Evaluate iterable expression
         auto iterableVal = iterableExpr_->evaluate(interpreter);
         if (iterableVal.getType() != Variables::Type::OBJECT) {
-            throw std::runtime_error("For-in loop applied to non-object at " + filename_ + ":" + std::to_string(line_) +
-                                     "," + std::to_string(column_));
+            throw Exception("For-in loop applied to non-object", filename_, line_, column_);
         }
         // Access underlying object map
         const auto & objMap = std::get<Value::ObjectMap>(iterableVal.get());

--
Gitblit v1.9.3