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

diff --git a/src/Interpreter/CallStatementNode.hpp b/src/Interpreter/CallStatementNode.hpp
index 224ac16..5724318 100644
--- a/src/Interpreter/CallStatementNode.hpp
+++ b/src/Interpreter/CallStatementNode.hpp
@@ -7,6 +7,8 @@
 
 #include "ExpressionNode.hpp"
 #include "Interpreter/Interpreter.hpp"
+// Include for unified runtime Exception (inherits BaseException)
+#include "BaseException.hpp"
 #include "Interpreter/OperationContainer.hpp"
 #include "StatementNode.hpp"
 #include "Symbols/FunctionSymbol.hpp"
@@ -54,15 +56,17 @@
         const std::string fnSymNs   = currentNs + ".functions";
         auto              sym       = sc->get(fnSymNs, functionName_);
         if (!sym || sym->getKind() != Kind::Function) {
-            throw std::runtime_error("Function not found: " + functionName_);
+            throw Exception("Function not found: " + functionName_, filename_, line_, column_);
         }
         auto funcSym = std::static_pointer_cast<FunctionSymbol>(sym);
 
         // Check parameter count
         const auto & params = funcSym->parameters();
         if (params.size() != argValues.size()) {
-            throw std::runtime_error("Function '" + functionName_ + "' expects " + std::to_string(params.size()) +
-                                     " args, got " + std::to_string(argValues.size()));
+            throw Exception(
+                "Function '" + functionName_ + "' expects " + std::to_string(params.size()) +
+                " args, got " + std::to_string(argValues.size()),
+                filename_, line_, column_);
         }
 
         // Enter function scope to bind parameters and execute body

--
Gitblit v1.9.3