|
|
## Error-handling
|
|
|
|
|
|
|
|
|
Mechanism: explicit propagation
|
|
|
|
|
|
There is no remote propagation, only local in between caller and callee methods.
|
|
|
|
|
|
| Syntax | AST | Type |
|
|
|
| --- | --- | --- |
|
|
|
| ``ok(e)`` | ``Result (Some e, None)`` | ``TResult(Some mt_e, None)``
|
|
|
| ``err(e)`` | ``Result(None, Some e)`` | ``TResult(None, Some mt_e)``
|
|
|
| ``e?`` | ``UnopExpr(UnpackOrPropagate, e)`` | mt_ok where ``e:TResult(mt_ok, mt_err)``
|
|
|
|
|
|
```
|
|
|
method tret method_name (targ_1 arg1, ..., targ_n arg_n) {
|
|
|
...
|
|
|
e? \in stmt
|
|
|
...
|
|
|
}
|
|
|
```
|
|
|
|
|
|
``tret = Result<tval, terr>`` and $[|e?|] = \text{if e is_ok then e else return error}$
|
|
|
|
|
|
|
|
|
|
|
|
Compiler internal
|
|
|
* Akka.Prepare elim UnpackOrPropagate and Ok/Err converted to vavr.Either type
|
|
|
|
|
|
Builtin functions generating error:
|
|
|
* fire
|
|
|
* receive
|
|
|
* select
|
|
|
* initiate_ |
|
|
\ No newline at end of file |