Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/matthewmueller/poss
- Owner: matthewmueller
- Created: 2016-03-17T11:11:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-18T06:38:42.000Z (almost 8 years ago)
- Last Synced: 2024-04-24T14:38:20.255Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 28
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
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