Skip to content

Commit

Permalink
Replaces duplicated logic with rxFatalErrorInDebug.
Browse files Browse the repository at this point in the history
  • Loading branch information
kzaher committed Nov 26, 2017
1 parent 7fbdb02 commit 0edb1e1
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions RxCocoa/Common/Observable+Bind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@ extension ObservableType {
case let .next(element):
relay.accept(element)
case let .error(error):
let error = "Binding error to publish relay: \(error)"
#if DEBUG
rxFatalError(error)
#else
print(error)
#endif
rxFatalErrorInDebug("Binding error to publish relay: \(error)")
case .completed:
break
}
Expand Down Expand Up @@ -92,12 +87,7 @@ extension ObservableType {
case let .next(element):
relay.accept(element)
case let .error(error):
let error = "Binding error to behavior relay: \(error)"
#if DEBUG
rxFatalError(error)
#else
print(error)
#endif
rxFatalErrorInDebug("Binding error to behavior relay: \(error)")
case .completed:
break
}
Expand Down Expand Up @@ -155,12 +145,7 @@ extension ObservableType {
*/
public func bind(onNext: @escaping (E) -> Void) -> Disposable {
return subscribe(onNext: onNext, onError: { error in
let error = "Binding error: \(error)"
#if DEBUG
rxFatalError(error)
#else
print(error)
#endif
rxFatalErrorInDebug("Binding error: \(error)")
})
}
}

0 comments on commit 0edb1e1

Please sign in to comment.