aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/order_watcher/event_watcher.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-01-10 20:51:09 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-01-11 20:22:04 +0800
commit292c3bbff81f6e1364109981123a35b1cb32f693 (patch)
treeb609eb040272a049d0b2980bb9b103288d6f512b /packages/0x.js/src/order_watcher/event_watcher.ts
parent065570ebf57eb37b14ffd0b2fe131c3dcec4064a (diff)
downloaddexon-sol-tools-292c3bbff81f6e1364109981123a35b1cb32f693.tar
dexon-sol-tools-292c3bbff81f6e1364109981123a35b1cb32f693.tar.gz
dexon-sol-tools-292c3bbff81f6e1364109981123a35b1cb32f693.tar.bz2
dexon-sol-tools-292c3bbff81f6e1364109981123a35b1cb32f693.tar.lz
dexon-sol-tools-292c3bbff81f6e1364109981123a35b1cb32f693.tar.xz
dexon-sol-tools-292c3bbff81f6e1364109981123a35b1cb32f693.tar.zst
dexon-sol-tools-292c3bbff81f6e1364109981123a35b1cb32f693.zip
Make some callbacks failable and add error handling
Diffstat (limited to 'packages/0x.js/src/order_watcher/event_watcher.ts')
-rw-r--r--packages/0x.js/src/order_watcher/event_watcher.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/packages/0x.js/src/order_watcher/event_watcher.ts b/packages/0x.js/src/order_watcher/event_watcher.ts
index fc0b9264c..43a60957b 100644
--- a/packages/0x.js/src/order_watcher/event_watcher.ts
+++ b/packages/0x.js/src/order_watcher/event_watcher.ts
@@ -36,6 +36,10 @@ export class EventWatcher {
this._intervalIdIfExists = intervalUtils.setAsyncExcludingInterval(
this._pollForBlockchainEventsAsync.bind(this, callback),
this._pollingIntervalMs,
+ (err: Error) => {
+ this.unsubscribe();
+ callback(err);
+ },
);
}
public unsubscribe(): void {
@@ -78,7 +82,7 @@ export class EventWatcher {
...log,
};
if (!_.isUndefined(this._intervalIdIfExists)) {
- callback(logEvent);
+ callback(null, logEvent);
}
}
}