From 4c4a4f64ce42d86db39bc9932d7cabd9c718138b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Guti=C3=A9rrez?= Date: Thu, 25 Apr 2019 14:03:52 +0200 Subject: [PATCH] Detect error inside the executor of SubscribableObserver if it returns a promise. --- src/utils/SubscribablePromise.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/SubscribablePromise.ts b/src/utils/SubscribablePromise.ts index 15f3d4f..8796d55 100644 --- a/src/utils/SubscribablePromise.ts +++ b/src/utils/SubscribablePromise.ts @@ -21,6 +21,12 @@ export class SubscribablePromise { this.observer.complete(result) } }) + .catch((result) => { + if (Promise.resolve(execution as any) === execution) { + this.observer.error(result) + } + }) + } public subscribe(onNext: (next: T) => void) {