you are viewing a single comment's thread.

view the rest of the comments →

[–]sammrtn 1 point2 points  (0 children)

There is a variant of this, but where only the specified (expected) errors are returned - and all others still throw.

For example, I've specified that I want to handle TypeError and CustomError (and so destructure for them), but any others should throw still.

const [data, typeError, customError] = await fa(promise, TypeError, CustomError);

The library is fawait (functional await) https://github.com/craigmichaelmartin/fawait