Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / src / internal / util / canReportError.ts
1 import { Subscriber } from '../Subscriber';
2 import { Subject } from '../Subject';
3
4 /**
5  * Determines whether the ErrorObserver is closed or stopped or has a
6  * destination that is closed or stopped - in which case errors will
7  * need to be reported via a different mechanism.
8  * @param observer the observer
9  */
10 export function canReportError(observer: Subscriber<any> | Subject<any>): boolean {
11   while (observer) {
12     const { closed, destination, isStopped } = observer as any;
13     if (closed || isStopped) {
14       return false;
15     } else if (destination && destination instanceof Subscriber) {
16       observer = destination;
17     } else {
18       observer = null;
19     }
20   }
21   return true;
22 }