From b983ab4b2048be7678ce56e05667847365866587 Mon Sep 17 00:00:00 2001 From: Ivan Bruel Date: Tue, 24 Jan 2017 17:01:28 +0000 Subject: [PATCH] Update Observable+Result.swift --- RxResult/Classes/Observable+Result.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RxResult/Classes/Observable+Result.swift b/RxResult/Classes/Observable+Result.swift index db351b8..f619836 100644 --- a/RxResult/Classes/Observable+Result.swift +++ b/RxResult/Classes/Observable+Result.swift @@ -17,7 +17,11 @@ public extension ObservableType { public func mapResult(_ errorType: U.Type) -> Observable> { return self.map(Result.success) - .catchError{ .just(Result.failure(U.failure(from: $0))) } + .catchError{ error in + if let error = error as? U { + return .just(Result.failure(error)) + } + return .just(Result.failure(U.failure(from: error))) } } }