diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-10 11:12:29 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-10 11:12:29 +0800 |
commit | 46e2da24a472560a8ff0fc9b068ec017dd5173dd (patch) | |
tree | d491244ff11123b7a4f65aba57cf6c74c5d6f7cd /test/utils | |
parent | dbbcbed34461f81ab62f46e811a7ec741739d3bf (diff) | |
download | dexon-0x-contracts-46e2da24a472560a8ff0fc9b068ec017dd5173dd.tar.gz dexon-0x-contracts-46e2da24a472560a8ff0fc9b068ec017dd5173dd.tar.zst dexon-0x-contracts-46e2da24a472560a8ff0fc9b068ec017dd5173dd.zip |
Add forgotten file
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/report_callback_errors.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/utils/report_callback_errors.ts b/test/utils/report_callback_errors.ts new file mode 100644 index 000000000..d471b2af2 --- /dev/null +++ b/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 = (...args: any[]) => { + try { + f(...args); + } catch (err) { + done(err); + } + }; + return wrapped; + }; +}; |