aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/test/utils/report_callback_errors.ts
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2018-01-13 07:51:23 +0800
committerGitHub <noreply@github.com>2018-01-13 07:51:23 +0800
commita95049450346459c5e6a211464e94fc4f702cebb (patch)
tree2cff4f477fd145f4eac897bc19d7dc0a3aecf723 /packages/0x.js/test/utils/report_callback_errors.ts
parent80a46d14beec7544849247f9362db3de3bae04a8 (diff)
parent6a56f209289105d7641c547a702469cbc9259029 (diff)
downloaddexon-0x-contracts-a95049450346459c5e6a211464e94fc4f702cebb.tar
dexon-0x-contracts-a95049450346459c5e6a211464e94fc4f702cebb.tar.gz
dexon-0x-contracts-a95049450346459c5e6a211464e94fc4f702cebb.tar.bz2
dexon-0x-contracts-a95049450346459c5e6a211464e94fc4f702cebb.tar.lz
dexon-0x-contracts-a95049450346459c5e6a211464e94fc4f702cebb.tar.xz
dexon-0x-contracts-a95049450346459c5e6a211464e94fc4f702cebb.tar.zst
dexon-0x-contracts-a95049450346459c5e6a211464e94fc4f702cebb.zip
Merge pull request #312 from 0xProject/feature/error-reporting-intervals
Better error handling on async/sync intervals
Diffstat (limited to 'packages/0x.js/test/utils/report_callback_errors.ts')
-rw-r--r--packages/0x.js/test/utils/report_callback_errors.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/0x.js/test/utils/report_callback_errors.ts b/packages/0x.js/test/utils/report_callback_errors.ts
index a7d9e61be..27c9745c9 100644
--- a/packages/0x.js/test/utils/report_callback_errors.ts
+++ b/packages/0x.js/test/utils/report_callback_errors.ts
@@ -25,7 +25,7 @@ export const reportNoErrorCallbackErrors = (done: DoneCallback, expectToBeCalled
};
};
-export const reportNodeCallbackErrors = (done: DoneCallback) => {
+export const reportNodeCallbackErrors = (done: DoneCallback, expectToBeCalledOnce = true) => {
return <T>(f?: (value: T) => void) => {
const wrapped = (error: Error | null, value: T | undefined) => {
if (!_.isNull(error)) {
@@ -37,7 +37,9 @@ export const reportNodeCallbackErrors = (done: DoneCallback) => {
}
try {
f(value as T);
- done();
+ if (expectToBeCalledOnce) {
+ done();
+ }
} catch (err) {
done(err);
}