Skip to content

Commit 533a38a

Browse files
committed
Improve 52d709c Printable-description.
1 parent 52d709c commit 533a38a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

SwiftTask/SwiftTask.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,16 @@ public class Task<Progress, Value, Error>: Printable
121121

122122
public var description: String
123123
{
124-
return self.name
124+
var valueString: String?
125+
126+
switch (self.state) {
127+
case .Fulfilled: valueString = "value=\(self.value!)"
128+
case .Rejected: fallthrough
129+
case .Cancelled: valueString = "errorInfo=\(self.errorInfo!)"
130+
default: valueString = "progress=\(self.progress)"
131+
}
132+
133+
return "<\(self.name); state=\(self.state.rawValue); \(valueString!))>"
125134
}
126135

127136
///

0 commit comments

Comments
 (0)