|
21 | 21 | { |
22 | 22 | "description": "Panics if none of the values are valid", |
23 | 23 | "rule": { "try": [{ "throw": "Some error" }, { "throw": "Some other error" }] }, |
24 | | - "error": true, |
| 24 | + "error": { "type": "Some other error" }, |
25 | 25 | "data": null |
26 | 26 | }, |
27 | 27 | { |
28 | 28 | "description": "Panics if none of the values are valid (2)", |
29 | 29 | "rule": { "try": [{ "throw": "Some error" }, { "/": [0, 0] }] }, |
30 | | - "error": true, |
| 30 | + "error": { "type": "NaN" }, |
31 | 31 | "data": null |
32 | 32 | }, |
33 | 33 | { |
34 | 34 | "description": "Panics if none of the values are valid (3)", |
35 | 35 | "rule": { "try": [{ "/": [0, 0] }, { "/": [1, 0] }, { "/": [2, 0] }] }, |
36 | | - "error": true, |
| 36 | + "error": { "type": "NaN" }, |
37 | 37 | "data": null |
38 | 38 | }, |
39 | 39 | { |
40 | 40 | "description": "Panics when the only argument is an error", |
41 | 41 | "rule": { "try": { "throw": "Some error" } }, |
42 | | - "error": true, |
| 42 | + "error": { "type": "Some error" }, |
43 | 43 | "data": null |
44 | 44 | }, |
45 | 45 | { |
46 | 46 | "description": "Panic with an error emitted from an operator", |
47 | 47 | "rule": { "try": [{ "/": [1, 0] }] }, |
48 | | - "error": true, |
| 48 | + "error": { "type": "NaN" }, |
49 | 49 | "data": null |
50 | 50 | }, |
51 | 51 | { |
52 | 52 | "description": "Panic within an iterator", |
53 | 53 | "rule": { "map": [[1, 2, 3], { "try": [{ "/": [0,0] }] }] }, |
54 | | - "error": true, |
| 54 | + "error": { "type": "NaN" }, |
55 | 55 | "data": null |
56 | 56 | }, |
57 | 57 | { |
58 | 58 | "description": "Panic based on an error emitted from an if", |
59 | 59 | "rule": { "try": [{ "if": [{"val": ["user", "admin"]}, true, { "throw": "Not an admin" }] }] }, |
60 | 60 | "data": { "user": { "admin": false } }, |
61 | | - "error": true |
| 61 | + "error": { "type": "Not an admin" } |
62 | 62 | }, |
63 | 63 | { |
64 | 64 | "description": "Try can work further up the AST with Exceptions", |
|
79 | 79 | "rule": { |
80 | 80 | "try": [ |
81 | 81 | { "throw": "Some error" }, |
82 | | - { "val": "error" } |
| 82 | + { "val": "type" } |
83 | 83 | ] |
84 | 84 | }, |
85 | 85 | "result": "Some error", |
|
90 | 90 | "rule": { |
91 | 91 | "try": [ |
92 | 92 | { "if": [true, { "throw": "Some error" }, null] }, |
93 | | - { "val": "error" } |
| 93 | + { "val": "type" } |
94 | 94 | ] |
95 | 95 | }, |
96 | 96 | "result": "Some error", |
|
102 | 102 | "try": [ |
103 | 103 | { "throw": "A" }, |
104 | 104 | { "throw": "B" }, |
105 | | - { "val": "error" } |
| 105 | + { "val": "type" } |
106 | 106 | ] |
107 | 107 | }, |
108 | 108 | "result": "B", |
|
111 | 111 | { |
112 | 112 | "description": "Error can pull from an error object", |
113 | 113 | "rule": { |
114 | | - "try": [{ "throw": { "val": "x" } }, { "val": "error" }] |
| 114 | + "try": [{ "throw": { "val": "x" } }, { "val": "type" }] |
115 | 115 | }, |
116 | | - "data": { "x": { "error": "Some error" }}, |
| 116 | + "data": { "x": { "type": "Some error" }}, |
117 | 117 | "result": "Some error" |
118 | 118 | }, |
119 | 119 | { |
|
125 | 125 | { "map": [[1,2,3], {"/": [0, 0] }]}, |
126 | 126 | null |
127 | 127 | ] |
128 | | - }, { "val": "error" }] |
| 128 | + }, { "val": "type" }] |
129 | 129 | }, |
130 | 130 | "result": "NaN", |
131 | 131 | "data": null |
|
136 | 136 | "try": [ |
137 | 137 | { "if": [{ "/": [1, { "val": "x" }] }, { "throw": "Some error" }, null] }, |
138 | 138 | { |
139 | | - "if": [{ "===": [{ "val": "error" }, "NaN"]}, "Handled", { "throw": { "val": [] } }] |
| 139 | + "if": [{ "===": [{ "val": "type" }, "NaN"]}, "Handled", { "throw": { "val": [] } }] |
140 | 140 | } |
141 | 141 | ] |
142 | 142 | }, |
|
148 | 148 | "rule": { |
149 | 149 | "try": [ |
150 | 150 | { "if": [{ "/": [1, { "val": "x" }] }, { "throw": "Some error" }, null] }, |
151 | | - { "if": [{ "===": [{ "val": "error" }, "NaN"]}, "Handled", { "throw": { "val": [] } }] } |
| 151 | + { "if": [{ "===": [{ "val": "type" }, "NaN"]}, "Handled", { "throw": { "val": [] } }] } |
152 | 152 | ] |
153 | 153 | }, |
154 | | - "error": true, |
| 154 | + "error": { "type": "Some error" }, |
155 | 155 | "data": { "x": 1 } |
156 | 156 | }, |
157 | 157 | "# Not Proposed", |
|
0 commit comments