From f42eed2d388a1f073dee6c4339227ec384bd6fc5 Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Tue, 12 Jan 2016 17:01:32 -0800 Subject: [PATCH] fix(Subscriber): errors in nextHandler no longer propagate to errorHandler fixes #1135 --- src/Subscriber.ts | 3 +-- src/util/tryOrOnError.ts | 11 ----------- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 src/util/tryOrOnError.ts diff --git a/src/Subscriber.ts b/src/Subscriber.ts index 7db085f767..955b30a55b 100644 --- a/src/Subscriber.ts +++ b/src/Subscriber.ts @@ -1,6 +1,5 @@ import {noop} from './util/noop'; import {throwError} from './util/throwError'; -import {tryOrOnError} from './util/tryOrOnError'; import {tryOrThrowError} from './util/tryOrThrowError'; import {Observer} from './Observer'; @@ -88,7 +87,7 @@ class SafeSubscriber extends Subscriber { error?: (e?: any) => void, complete?: () => void) { super(); - this._next = (typeof next === 'function') && tryOrOnError(next) || null; + this._next = (typeof next === 'function') && tryOrThrowError(next) || null; this._error = (typeof error === 'function') && tryOrThrowError(error) || throwError; this._complete = (typeof complete === 'function') && tryOrThrowError(complete) || null; } diff --git a/src/util/tryOrOnError.ts b/src/util/tryOrOnError.ts deleted file mode 100644 index b95669a7a5..0000000000 --- a/src/util/tryOrOnError.ts +++ /dev/null @@ -1,11 +0,0 @@ -export function tryOrOnError(target: Function): (x?: any) => any { - function tryCatcher() { - try { - ( tryCatcher).target.apply(this, arguments); - } catch (e) { - this.error(e); - } - } - ( tryCatcher).target = target; - return tryCatcher; -}