Skip to content

A proper way to catch all errors from promises.

Notifications You must be signed in to change notification settings

mbarinov/catch.all

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

catch.all

travis build codecov coverage version downloads MIT License semantic-release

JS playground

Get all errors from an array of promises.

Installation

This package is distributed via npm:

npm install catch.all

Usage

import catchAll from 'catch.all';

const promises = [
    Promise.reject('error1'),
    Promise.reject('error2')
]

catchAll(promises).then(errors => {
    console.log(errors)
    // ['error1','error2']
    return errors
})

const badArg = {};

catchAll(badArg)
.catch(e => {
    console.log(e.message)
    // "promises[Symbol.iterator] is not a function"
});

Other

This library was developed by Max Barinov.

About

A proper way to catch all errors from promises.

Resources

Stars

Watchers

Forks

Packages

No packages published