0.1.1 • Published 6 years ago

catch-errors v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

catch-errors

Generated by OSS Project Generator.

NPM Version License

A high-order function to catch errors from promises.

Installation

Install package

$ npm install --save catch-errors

Usage

const fetch = require('node-fetch');
const catchErrors = require('catch-errors');

async function load(username) {
  const response = await fetch(`https://api.github.com/users/${username}`);
  const user = await response.json();
  console.log(user.name);
}

const wrappedLoad = catchErrors(load);

wrappedLoad('robertoachar');

Development

  • Cloning the repo
$ git clone https://github.com/robertoachar/node-catch-errors.git
  • Installing dependencies
$ npm install
  • Running scripts
ActionUsage
Linting codenpm run lint

Author

Roberto Achar

License

MIT