simon
Simon is a Promise extension that provides filtered catch handler ... made for Simon.
Install
npm install --production --save simon-promise
API
The same native Promise API applies, the only difference is the catch()
method.
.catch(onRejected)
Behaves normally as per the native Promise API
.catch(class ErrorClass | class CustomErrorClass | ... , onRejected)
A filtered variant of catch
(like other non-JS languages typically have) that lets you only handle specific errors.
The catch handler that is first met that has eligible constructors specified, is the one that will be called.
Example:
somePromise
You may also add multiple filters for a catch handler:
somePromise
©️ www.ahmadnassri.com · License: ISC · Github: @ahmadnassri · Twitter: @ahmadnassri