diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-21 01:13:54 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-11-21 01:13:54 +0800 |
commit | 20449a0cb293649d9c301781dd89e7c26cc7a6b6 (patch) | |
tree | b6796ee701fcb0ef3a130c78562d84d1e581c4ed /packages/0x.js/src | |
parent | 856a5c3369c0248ec32924b25ec77dce6b4e1071 (diff) | |
download | dexon-0x-contracts-20449a0cb293649d9c301781dd89e7c26cc7a6b6.tar.gz dexon-0x-contracts-20449a0cb293649d9c301781dd89e7c26cc7a6b6.tar.zst dexon-0x-contracts-20449a0cb293649d9c301781dd89e7c26cc7a6b6.zip |
Throw when subscription is already removed
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r-- | packages/0x.js/src/order_watcher/expiration_watcher.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/0x.js/src/order_watcher/expiration_watcher.ts b/packages/0x.js/src/order_watcher/expiration_watcher.ts index 6d9556336..f9c6571db 100644 --- a/packages/0x.js/src/order_watcher/expiration_watcher.ts +++ b/packages/0x.js/src/order_watcher/expiration_watcher.ts @@ -35,7 +35,10 @@ export class ExpirationWatcher { ); } public unsubscribe(): void { - intervalUtils.clearAsyncExcludingInterval(this.orderExpirationCheckingIntervalIdIfExists as NodeJS.Timer); + if (_.isUndefined(this.orderExpirationCheckingIntervalIdIfExists)) { + throw new Error(ZeroExError.SubscriptionNotFound); + } + intervalUtils.clearAsyncExcludingInterval(this.orderExpirationCheckingIntervalIdIfExists); delete this.callbackIfExists; } public addOrder(orderHash: string, expirationUnixTimestampSec: BigNumber): void { |