File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2671,6 +2671,21 @@ b: "Hello \( a )!" // Hello World!
2671
2671
2672
2672
Builtin functions are predeclared. They are called like any other function.
2673
2673
2674
+ ### ` error `
2675
+
2676
+ ` error ` allows user to create an error value with a custom message.
2677
+ An error value can be used in a disjunction, where it will be discarded if
2678
+ there is a valid disjunct, but it will be reported as the sole error value in
2679
+ case all disjuncts fail.
2680
+
2681
+ ` error ` takes a single string argument. If this argument is a literal
2682
+ interpolation, it will be extra resilient: if any of the arguments to the
2683
+ interpolation fail, they will be printed as an expression. This allows failing
2684
+ expressions to be a part of the error message.
2685
+
2686
+ ```
2687
+ a: 1/0 | error("infinity and beyond!: \(1/0)")
2688
+ ```
2674
2689
2675
2690
### ` len `
2676
2691
You can’t perform that action at this time.
0 commit comments