catch-if
v0.0.1
Published
A catIf syntactic sugar for Javscrip promises
Downloads
2
Readme
catch-if.js
A catIf syntactic sugar for Javscrip promises
Installation
npm i catch-if -S
Usage
Step:1 - Monkeypatch your Promise class
require('catch-if')(Promise);
Step:2 - Use catchIf method
Promise.reject( new TypeError() )
.catchIf( TypeError, function handler(err){ console.log('TypeError handled')} )
.catchIf( RangeError, function handler(err){ console.log('RangeError handled')} )