aboutsummaryrefslogtreecommitdiffstats
path: root/main/exception/ExceptionManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/exception/ExceptionManager.java')
-rw-r--r--main/exception/ExceptionManager.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/main/exception/ExceptionManager.java b/main/exception/ExceptionManager.java
new file mode 100644
index 0000000..0ceb25b
--- /dev/null
+++ b/main/exception/ExceptionManager.java
@@ -0,0 +1,29 @@
+package com.jantuomi.interpreter.main.exception;
+
+import java.util.List;
+
+/**
+ * Created by jan on 10.6.2016.
+ */
+public class ExceptionManager {
+
+ private static final ExceptionManager instance = new ExceptionManager();
+
+ private ExceptionManager() {
+ }
+
+ public static ExceptionManager getInstance() {
+ return instance;
+ }
+
+ public static void raise(InterpreterException.Exception ex, int line, List<String> args) {
+ InterpreterException e = new InterpreterException(ex);
+ String output = e.what();
+ for (String arg : args) {
+ output = String.format(output, arg);
+ }
+ System.err.println(String.format("[%s] line: %d %s", ex.toString(), line, output));
+ }
+
+
+}