notificationCenterPublisher = NotificationCenter.default
.publisher(for: .NSManagedObjectContextObjectsDidChange, object: context)
.map { (notification) -> (CoreDataContextObserverState) in
self.handleContextObjectDidChangeNotification(notification: notification)
}
.eraseToAnyPublisher()
I have the method handleContextObjectDidChangeNotification doing the mapping.
Right now notificationCenterPublisher is of type AnyPublisher<CoreDataContextObserverState, Never>
But I want to make it AnyPublisher<CoreDataContextObserverState, Error> and have handleContextObjectDidChangeNotification have some way of indicating an error has occured.
How do I do that?