1.0.0 • Published 7 years ago

suppress v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

suppress

A Node.js module that wraps around a function and suppresses whatever errors it might throw.

When suppressing errors from functions that normally return a value, you can optionally specify a "fallback value" to be returned in the event of an error.

Installation

npm install suppress --save

Usage

const suppress = require('suppress')

function thrower () {
  throw new Error()
}

suppress(thrower)() // undefined
suppress(thrower, 'return if error')() // 'return if error'