This crate provides a macro that enables the familiar try-catch
syntax of other programming languages.
It can be used to easlily group errors and manage them dynamically by type rather than value.
use catch;
use *;
use Value;
catch! ;
Note, if no wildcard is present then the compiler will warn about unused results. It can alo be used as an expression:
// We can guarantee that all errors are catched
// so the type of this expression is `i32`.
// It can be guarantieed because the final catch
// does not specify an Error type.
let number: i32 = catch! ;
// we can't know for sure if all possible errors are
// handled so the type is still Result.
let result: = catch! ;