|
12 | 12 | "result": 1, |
13 | 13 | "data": { "hello": "world" } |
14 | 14 | }, |
| 15 | + { |
| 16 | + "description": "Try is variadic", |
| 17 | + "rule": { "try": [{ "error": "Some error" }, { "/": [0, 0] }, 2] }, |
| 18 | + "result": 2, |
| 19 | + "data": null |
| 20 | + }, |
15 | 21 | { |
16 | 22 | "description": "Panics if none of the values are valid", |
17 | 23 | "rule": { "try": [{ "error": "Some error" }, { "error": "Some other error" }] }, |
|
24 | 30 | "error": true, |
25 | 31 | "data": null |
26 | 32 | }, |
| 33 | + { |
| 34 | + "description": "Panics if none of the values are valid (3)", |
| 35 | + "rule": { "try": [{ "/": [0, 0] }, { "/": [1, 0] }, { "/": [2, 0] }] }, |
| 36 | + "error": true, |
| 37 | + "data": null |
| 38 | + }, |
27 | 39 | { |
28 | 40 | "description": "Can promote a soft error to a hard error", |
29 | 41 | "rule": { "try": { "error": "Some error" } }, |
|
64 | 76 | }, |
65 | 77 | { |
66 | 78 | "description": "The context switches for the try coalescing to the previous error", |
| 79 | + "rule": { |
| 80 | + "try": [ |
| 81 | + { "error": "Some error" }, |
| 82 | + { "val": [] } |
| 83 | + ] |
| 84 | + }, |
| 85 | + "result": { "error": "Some error"}, |
| 86 | + "data": null |
| 87 | + }, |
| 88 | + { |
| 89 | + "description": "The context switches for the try coalescing to the previous error (2)", |
67 | 90 | "rule": { |
68 | 91 | "try": [ |
69 | 92 | { "if": [true, { "error": "Some error" }, null] }, |
|
73 | 96 | "result": { "error": "Some error"}, |
74 | 97 | "data": null |
75 | 98 | }, |
| 99 | + { |
| 100 | + "description": "The context switches for the try coalescing to the previous error (3)", |
| 101 | + "rule": { |
| 102 | + "try": [ |
| 103 | + { "error": "A" }, |
| 104 | + { "error": "B" }, |
| 105 | + { "val": [] } |
| 106 | + ] |
| 107 | + }, |
| 108 | + "result": { "error": "B" }, |
| 109 | + "data": null |
| 110 | + }, |
76 | 111 | { |
77 | 112 | "description": "Try can work further up the AST with Exceptions, and return the error", |
78 | 113 | "rule": { |
|
0 commit comments