`try-catch` as expression
Summary
Add an expression version of try-catch
to the library.
Proposal
import { yrt } from "cont-flow-expr";
const value = yrt(() => { /* potentially throws */; return optionA; })
.catch((error) => { /* use `error` */; return return optionB; })
.finally(() => { /* do something */ });
Open questions
.finally
should probably be included for completeness, but it's not clear what to do with its return value.
Edited by Eric Cornelissen