Throw when subscription is already removed

This commit is contained in:
Leonid Logvinov
2017-11-20 11:13:54 -06:00
parent 856a5c3369
commit 20449a0cb2

View File

@@ -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 {