gotta-catch-em-all

0.0.3 • Public • Published

Gotta Catch Em All!

For when your pokemon is being unruly and you have no idea why. In other words, it catches unhandled rejections (usually caused by using ES6 Promises) in Node v6+.

Installation

npm install --save-dev gotta-catch-em-all

Usage

import { gottaCatchEmAll, gottaReleaseEmAll } from 'gotta-catch-em-all'
 
gottaCatchEmAll() // Start logging unhandled rejections
 
Promise.reject(new Error('I shall not get uncaught!')) // Throw a fugitive error
 
setTimeout(() => { gottaReleaseEmAll() }, 0) // Logs all unhandled rejections to the console
// Example:
// Unhandled Rejection: Error: I shall not get uncaught!
// ...
// stack trace output
// ....

Note: Remember to only call "gottaReleaseEmAll" after the async calls are done. Calling "gottaReleaseEmAll" is entirely optional, if left uncalled, unhandled rejections will be logged to the console when node exits.

Package Sidebar

Install

npm i gotta-catch-em-all

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • m-a-r-c-e-l-i-n-o