aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 11:12:29 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 11:12:29 +0800
commit46e2da24a472560a8ff0fc9b068ec017dd5173dd (patch)
treed491244ff11123b7a4f65aba57cf6c74c5d6f7cd
parentdbbcbed34461f81ab62f46e811a7ec741739d3bf (diff)
downloaddexon-0x-contracts-46e2da24a472560a8ff0fc9b068ec017dd5173dd.tar.gz
dexon-0x-contracts-46e2da24a472560a8ff0fc9b068ec017dd5173dd.tar.zst
dexon-0x-contracts-46e2da24a472560a8ff0fc9b068ec017dd5173dd.zip
Add forgotten file
-rw-r--r--test/utils/report_callback_errors.ts14
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;
+ };
+};