New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

catch-errors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

catch-errors

A high-order function to catch errors from promises.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

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

Keywords

node

FAQs

Package last updated on 13 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts