diff interps/rail/src/Error.h @ 996:859f9b4339e6

<Gregor> tar xf egobot.tar.xz
author HackBot
date Sun, 09 Dec 2012 19:30:08 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/interps/rail/src/Error.h	Sun Dec 09 19:30:08 2012 +0000
@@ -0,0 +1,58 @@
+// Error.h
+
+#ifndef ERROR_H_RAIL_1
+#define ERROR_H_RAIL_1
+
+namespace Error
+{
+  enum t
+  {
+    min = 0,
+    runnable = 0,
+    finished,
+    custom,
+    noValidMove,
+    ambiguousMove,
+    wrongDirectionIntoJunction,
+    stackUnderflow,
+    typeMismatch,
+    invalidCharInFunctionName,
+    invalidCharInConstant,
+    invalidEscapeSequence,
+    invalidCharInVariableName,
+    multiOutOfBounds,
+    localBindingNotFound,
+    globalBindingNotFound,
+    noMoreInput,
+    indexOutOfBounds,
+    max = indexOutOfBounds,
+    count = max + 1
+  };
+
+  std::string errorToString(t current);
+};
+
+class CrashException
+{
+public:
+  explicit CrashException(Error::t newType, std::string newCustom="")
+    : type(newType)
+    , custom(newCustom)
+  {
+  }
+
+  Error::t get(void)
+  {
+    return type;
+  }
+
+  std::string getCustom(void)
+  {
+    return custom;
+  }
+private:
+  Error::t type;
+  std::string custom;
+};
+
+#endif