996
|
1 // Error.h
|
|
2
|
|
3 #ifndef ERROR_H_RAIL_1
|
|
4 #define ERROR_H_RAIL_1
|
|
5
|
|
6 namespace Error
|
|
7 {
|
|
8 enum t
|
|
9 {
|
|
10 min = 0,
|
|
11 runnable = 0,
|
|
12 finished,
|
|
13 custom,
|
|
14 noValidMove,
|
|
15 ambiguousMove,
|
|
16 wrongDirectionIntoJunction,
|
|
17 stackUnderflow,
|
|
18 typeMismatch,
|
|
19 invalidCharInFunctionName,
|
|
20 invalidCharInConstant,
|
|
21 invalidEscapeSequence,
|
|
22 invalidCharInVariableName,
|
|
23 multiOutOfBounds,
|
|
24 localBindingNotFound,
|
|
25 globalBindingNotFound,
|
|
26 noMoreInput,
|
|
27 indexOutOfBounds,
|
|
28 max = indexOutOfBounds,
|
|
29 count = max + 1
|
|
30 };
|
|
31
|
|
32 std::string errorToString(t current);
|
|
33 };
|
|
34
|
|
35 class CrashException
|
|
36 {
|
|
37 public:
|
|
38 explicit CrashException(Error::t newType, std::string newCustom="")
|
|
39 : type(newType)
|
|
40 , custom(newCustom)
|
|
41 {
|
|
42 }
|
|
43
|
|
44 Error::t get(void)
|
|
45 {
|
|
46 return type;
|
|
47 }
|
|
48
|
|
49 std::string getCustom(void)
|
|
50 {
|
|
51 return custom;
|
|
52 }
|
|
53 private:
|
|
54 Error::t type;
|
|
55 std::string custom;
|
|
56 };
|
|
57
|
|
58 #endif
|