@playerony/try-catch-wrapper
Version:
Functional try-catch wrapper.
39 lines (25 loc) • 1.15 kB
Markdown
# try catch wrapper






Functional try-catch wrapper.
- [API Docs](https://playerony.github.io/try-catch-wrapper)
# Installation ([npm](https://www.npmjs.com/package/@playerony/try-catch-wrapper))
```
npm i @playerony/try-catch-wrapper
```
```
yarn add @playerony/try-catch-wrapper
```
# Usage
```js
import { tryCatchWrapper, asyncTryCatchWrapper } from '@playerony/try-catch-wrapper';
const onSuccess = () => console.log('success');
const asyncOnSuccess = async () => Promise.resolve(10);
const onError = () => console.log('error');
tryCatchWrapper(onSuccess, onError);
asyncTryCatchWrapper(asyncOnSuccess, onError);
```