1.0.2 • Published 6 years ago

@fizzygalacticus/trythis v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

trythis

A util to help trace errors

Installation

Using npm:

npm i --save-dev @fizzygalacticus/trythis

Using yarn:

yarn add --dev @fizzygalacticus/trythis

Usage

trythis can be used on both asynchronous and synchronous functions:

synchronous:

trythis(() => `this shouldn't throw`)(/* ...params */);
trythis(() => {throw new Error('this should throw')})(/* ...params */);

output: sync-output

asynchronous:

trythis(() => Promise.resolve(`this shouldn't throw`))(/* ...params */);
trythis(() => Promise.reject('this should throw'))(/* ...params */);

output: async-output