UNPKG

apr-intercept

Version:

Intercepts errors, the Go way!

25 lines (15 loc) 819 B
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> ## intercept <a id="intercept"></a> Intercepts errors, the Go way! [![](https://img.shields.io/npm/v/apr-intercept.svg?style=flat-square)](https://www.npmjs.com/package/apr-intercept) [![](https://img.shields.io/npm/l/apr-intercept.svg?style=flat-square)](https://www.npmjs.com/package/apr-intercept) **Parameters** - `input` **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** **Examples** ```javascript import ctch from 'apr-intercept'; const [err1, res1] = await ctch(fn(1)); const [err2, res2] = await ctch(fn(1)); const [, res3] = await ctch(fn(3)); ``` Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**