From 038668efdfdd2eac85c30206e17128b0af2b48ce Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 5 Dec 2017 15:45:35 -0600 Subject: Port subproviders over to mono repo, refactor LedgerSubprovider to no longer rely on hookedWalletSubprovider. Added unit and integration tests. --- packages/subproviders/test/utils/report_callback_errors.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/subproviders/test/utils/report_callback_errors.ts (limited to 'packages/subproviders/test/utils') diff --git a/packages/subproviders/test/utils/report_callback_errors.ts b/packages/subproviders/test/utils/report_callback_errors.ts new file mode 100644 index 000000000..8a8f4d966 --- /dev/null +++ b/packages/subproviders/test/utils/report_callback_errors.ts @@ -0,0 +1,14 @@ +import { DoneCallback } from '../../src/types'; + +export const reportCallbackErrors = (done: DoneCallback) => { + return (f: (...args: any[]) => void) => { + const wrapped = async (...args: any[]) => { + try { + f(...args); + } catch (err) { + done(err); + } + }; + return wrapped; + }; +}; -- cgit