From 21bcde9415c64eb4a948c76a00856dfce6ce1b7d Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Thu, 24 Sep 2020 19:45:31 +0200 Subject: [PATCH] Add errors to finishing method --- Sources/GCDCoreOperations/Base Classes/Operation.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/GCDCoreOperations/Base Classes/Operation.swift b/Sources/GCDCoreOperations/Base Classes/Operation.swift index 6e12115..07f3ccf 100644 --- a/Sources/GCDCoreOperations/Base Classes/Operation.swift +++ b/Sources/GCDCoreOperations/Base Classes/Operation.swift @@ -185,7 +185,7 @@ open class Operation { errors.append(contentsOf: errs.lazy.map { $0 }) _state.withValue { $0 = .finished(cancelled: cancelled) } - didFinish(wasCancelled: cancelled) + didFinish(wasCancelled: cancelled, errors: errors) observers.operationDidFinish(self, wasCancelled: cancelled, errors: errors) if cancelled { @@ -216,11 +216,11 @@ open class Operation { cancel(with: errors) } - open func didFinish(wasCancelled: Bool) {} + open func didFinish(wasCancelled: Bool, errors: [Error]) {} } // MARK: - Nested Types -internal extension Operation { +extension Operation { enum State: Comparable, CustomStringConvertible { case created case enqueued