diff options
Diffstat (limited to 'packages/subproviders/test/utils')
-rw-r--r-- | packages/subproviders/test/utils/report_callback_errors.ts | 14 |
1 files changed, 14 insertions, 0 deletions
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; + }; +}; |