A util to help trace errors
Using npm:
npm i --save-dev @fizzygalacticus/trythisUsing yarn:
yarn add --dev @fizzygalacticus/trythistrythis can be used on both asynchronous and synchronous functions:
synchronous:
trythis(() => `this shouldn't throw`)(/* ...params */);
trythis(() => {throw new Error('this should throw')})(/* ...params */);asynchronous:
trythis(() => Promise.resolve(`this shouldn't throw`))(/* ...params */);
trythis(() => Promise.reject('this should throw'))(/* ...params */);