Improve error handling

This commit is contained in:
Alfonso Grillo
2023-01-20 17:59:09 +01:00
parent 9e21915a4e
commit 93ae25b998
3 changed files with 14 additions and 8 deletions
@@ -22,12 +22,18 @@ protocol PollHistoryServiceProtocol {
var pollHistory: AnyPublisher<TimelinePollDetails, Never> { get }
/// Publishes whatever errors produced during the sync.
var error: AnyPublisher<Error, Never> { get }
var error: AnyPublisher<PollHistoryError, Never> { get }
/// Ask to fetch the next batch of polls.
/// Concrete implementations can decide what a batch is.
func next()
/// Inform the whenever a new batch of polls starts or ends.
/// Inform whenever the fetch of a new batch of polls starts or ends.
var isFetching: AnyPublisher<Bool, Never> { get }
}
enum PollHistoryError: Error {
case paginationFailed(Error)
case timelineUnavailable
case pollAggregationFailed(Error)
}