Skip to content

Commit 53e24ae

Browse files
committed
Allow failureClosure to return different Progress type, i.e. Task<Progress2, Value, Error>
1 parent 44d74bd commit 53e24ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

SwiftTask/SwiftTask.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,9 @@ public class Task<Progress, Value, Error>: Printable
640640
/// - e.g. task.failure { errorInfo -> NextTaskType in ... }
641641
/// - e.g. task.failure { error, isCancelled -> NextTaskType in ... }
642642
///
643-
public func failure(failureClosure: ErrorInfo -> Task) -> Task
643+
public func failure<Progress2>(failureClosure: ErrorInfo -> Task<Progress2, Value, Error>) -> Task<Progress2, Value, Error>
644644
{
645-
return Task { [weak self] machine, progress, fulfill, _reject, configure in
645+
return Task<Progress2, Value, Error> { [weak self] machine, progress, fulfill, _reject, configure in
646646

647647
let bind = { [weak machine] (errorInfo: ErrorInfo) -> Void in
648648
let innerTask = failureClosure(errorInfo)

0 commit comments

Comments
 (0)