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/Interpreter.hpp |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/Interpreter/Interpreter.hpp b/src/Interpreter/Interpreter.hpp
index e67443b..e573552 100644
--- a/src/Interpreter/Interpreter.hpp
+++ b/src/Interpreter/Interpreter.hpp
@@ -7,6 +7,23 @@
 #include "Interpreter/Operation.hpp"
 #include "Interpreter/OperationContainer.hpp"
 #include "Symbols/SymbolContainer.hpp"
+#include "BaseException.hpp"
+
+// Exception type for runtime errors, includes file, line, and column context
+namespace Interpreter {
+class Exception : public BaseException {
+public:
+    Exception(const std::string &msg, const std::string &filename, int line, size_t column) {
+        rawMessage_ = msg;
+        context_ = std::string(" in file \"") + filename + "\" at line: " + std::to_string(line)
+                   + ", column: " + std::to_string(column);
+        formattedMessage_ = formatMessage();
+    }
+    std::string formatMessage() const override {
+        return std::string("[Runtime ERROR] >>") + context_ + " << : " + rawMessage_;
+    }
+};
+} // namespace Interpreter
 
 namespace Interpreter {
 

--
Gitblit v1.9.3