Skip to content

Commit

Permalink
feat(ObjectUnsubscribedError): add ObjectUnsubscribed error class
Browse files Browse the repository at this point in the history
this class was added to support throwing errors when members of Subjects were accessed in invalid ways after the Subject has been unsubscribed

related #859
related #758
  • Loading branch information
benlesh committed Dec 8, 2015
1 parent 33b387b commit 39836af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Rx.KitchenSink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ import {BehaviorSubject} from './subject/BehaviorSubject';
import {ConnectableObservable} from './observable/ConnectableObservable';
import {Notification} from './Notification';
import {EmptyError} from './util/EmptyError';
import {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
import {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
import {nextTick} from './scheduler/nextTick';
import {immediate} from './scheduler/immediate';
Expand Down Expand Up @@ -167,6 +168,7 @@ export {
Notification,
EmptyError,
ArgumentOutOfRangeError,
ObjectUnsubscribedError,
TestScheduler,
VirtualTimeScheduler,
TimeInterval
Expand Down
5 changes: 3 additions & 2 deletions src/Rx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ import {ConnectableObservable} from './observable/ConnectableObservable';
import {Notification} from './Notification';
import {EmptyError} from './util/EmptyError';
import {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
import {nextTick} from './scheduler/nextTick';
import {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
import {immediate} from './scheduler/immediate';
import {NextTickScheduler} from './scheduler/NextTickScheduler';
import {ImmediateScheduler} from './scheduler/ImmediateScheduler';
Expand All @@ -142,5 +142,6 @@ export {
ConnectableObservable,
Notification,
EmptyError,
ArgumentOutOfRangeError
ArgumentOutOfRangeError,
ObjectUnsubscribedError
};
10 changes: 10 additions & 0 deletions src/util/ObjectUnsubscribedError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* an error thrown when an action is invalid because the object
* has been unsubscribed
*/
export class ObjectUnsubscribedError extends Error {
constructor() {
super('object unsubscribed');
this.name = 'ObjectUnsubscribedError';
}
}

0 comments on commit 39836af

Please sign in to comment.