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/DeclareFunctionStatementNode.hpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Interpreter/DeclareFunctionStatementNode.hpp b/src/Interpreter/DeclareFunctionStatementNode.hpp
index bb3eea7..f2ddb04 100644
--- a/src/Interpreter/DeclareFunctionStatementNode.hpp
+++ b/src/Interpreter/DeclareFunctionStatementNode.hpp
@@ -8,6 +8,8 @@
 #include "ExpressionNode.hpp"
 #include "Interpreter.hpp"
 #include "Interpreter/StatementNode.hpp"
+// Include for unified runtime Exception
+#include "Interpreter/Interpreter.hpp"
 #include "Symbols/ParameterContainer.hpp"
 #include "Symbols/SymbolContainer.hpp"
 #include "Symbols/SymbolFactory.hpp"
@@ -37,8 +39,7 @@
     void interpret(Interpreter & /*interpreter*/) const override {
         //Symbols::Value value = expression_->evaluate(interpreter);
         if (Symbols::SymbolContainer::instance()->exists(functionName_)) {
-            throw std::runtime_error("Function already declared: " + functionName_ + " file: " + filename_ +
-                                     ", line: " + std::to_string(line_) + ", column: " + std::to_string(column_));
+            throw Exception("Function already declared: " + functionName_, filename_, line_, column_);
         }
         const auto func = Symbols::SymbolFactory::createFunction(functionName_, ns, params_, "", returnType_);
         Symbols::SymbolContainer::instance()->add(func);

--
Gitblit v1.9.3