1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Detect error inside the executor of SubscribableObserver if it returns a promise.

This commit is contained in:
Pedro Gutiérrez 2019-04-25 14:03:52 +02:00 committed by Pedro Gutiérrez
parent e76c152bfc
commit 4c4a4f64ce

View File

@ -21,6 +21,12 @@ export class SubscribablePromise<T extends any, P extends any> {
this.observer.complete(result)
}
})
.catch((result) => {
if (Promise.resolve(execution as any) === execution) {
this.observer.error(result)
}
})
}
public subscribe(onNext: (next: T) => void) {