Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/matthewmueller/poss

Slightly better-looking error handling for async/await & generators
https://github.com/matthewmueller/poss

Last synced: 16 days ago
JSON representation

Slightly better-looking error handling for async/await & generators

Awesome Lists containing this project

README

        

# poss

**"This poss might work..."**

Slightly better-looking error handling for generators and async/await.

## Instead of this:

```js
try {
var resource = await fetch(token)
} catch (err) {
// do something with the error
}
// do something with the resource
```

You can do this:

```js
const [err, resource] = await poss(fetch(token))
if (err !== null) {
// do something with the error
}

// do something with the resource
```

## Installation

```
npm install poss
```

## License

MIT