An open API service indexing awesome lists of open source software.

https://github.com/klipitkas/await-to

Solve the try-catch hell using golang style error handling.
https://github.com/klipitkas/await-to

hell js try try-catch trycatch

Last synced: 3 months ago
JSON representation

Solve the try-catch hell using golang style error handling.

Awesome Lists containing this project

README

        

# await-to

Solve the try-catch hell using golang style error handling.

## Install

npm i @klipitkas/await-to --save

## Usage

```js
import { to } from 'await-to';

const doSomething = () => {
const [ data, error ] = await to(resolveOrRejectSomePromise());

if (error) {
throw new Error("Whoops!");
}

return data;
}
```

## Test

npm run test