Package Exports
- @trenskow/fail-silently
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@trenskow/fail-silently) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@trenskow/fail-silently
A simple function wrapper for ignoring errors thrown.
Usage
You wrap the function you want to ignore errors thrown from as the example below.
const
failSilently = require('@trenskow/fail-silently');
function myThrowingFunction(shouldThrow) {
if (shouldThrow) throw new Error("This is my error.");
return 'Hello, World!';
}
failSilently(myThrowingFunction)(false); // -> 'Hello, World!'
failSilently(myThrowingFunction)(true); // -> undefinedIt also works with
asyncfunctions.
LICENSE
See license in LICENSE