Promise Catcher
Simple promise try catch wrapper written in Typescript. Suggestions are welcome.
Installation
You can grab the latest version via NPM.
npm install --save promise-catcher
Then use require through Typescript.
The Problem
When using ES6 promises with packages that do not catch your async rejections you may be familiar with this error.
node: UnhandledPromiseRejectionWarning: Unhandled promise : RequestError:
To solve this we need to wrap our calls in try catch statements to make sure we are handling them correctly.
//Using callbacks in expressapp
//Using throws in jasmine
Our Solution
This package contains convenience functions that wrap your async functions in try catch and pass the error onwards properly.
//Using callbacks in expressapp
//Using throws in jasmine
//Use with any callbackscatcher //Use with any throwingcatcher