await-to-fetch

2.0.0 • Public • Published

await-to-fetch Build Status

Easy error handling for async/await without try/catch blocks that works with fetch.

Install

$ npm install await-to-fetch

Usage

import to from 'await-to-fetch'

async function example() {
  const [err, res] = await to(fetch('https://httpstat.us/200'))

  if (err) {
    throw err
  }

  return res
}

Credits

Readme

Keywords

none

Package Sidebar

Install

npm i await-to-fetch

Weekly Downloads

1

Version

2.0.0

License

ISC

Unpacked Size

4.9 kB

Total Files

9

Last publish

Collaborators

  • oh