mirror of https://github.com/rust-lang/rfcs
s/try/catch
This commit is contained in:
parent
00e839fe4d
commit
d9e79e4c57
|
@ -128,7 +128,7 @@ behavior of exception-handling code.
|
|||
|
||||
Note that `catch { foo()? }` is essentially equivalent to `foo()`.
|
||||
`catch` can be useful if you want to coalesce *multiple* potential
|
||||
exceptions -- `try { foo()?.bar()?.baz()? }` -- into a single
|
||||
exceptions -- `catch { foo()?.bar()?.baz()? }` -- into a single
|
||||
`Result`, which you wish to then e.g. pass on as-is to another
|
||||
function, rather than analyze yourself. (The last example could also
|
||||
be expressed using a series of `and_then` calls.)
|
||||
|
|
Loading…
Reference in New Issue