Open
Bug 1148589
Opened 9 years ago
Updated 2 years ago
Combine Cursor.status and Cursor.statusMessage
Categories
(Firefox for iOS :: Data Storage, defect)
Tracking
()
NEW
People
(Reporter: wesj, Unassigned)
Details
Stefan suggested this in a PR: I would love to see status and statusMessage folded into one enum like this: enum CursorStatus { case Success, Failure(String), Closed var message: { switch self { case Success: return "Success" case Closed: return "Closed" case Error(let message): return message } } } Then the whole concept of status and a status message is nicely captured in one testable thing. No need anymore to use or test for/with hardcoded strings like "Success". More formal protocol. Then in case of .Failure you can set the status to: var someStatus: CursorStatus = .Failure("Thing thing did not work") And to check for failure: if status == .Failure { println(status.message) } Or in a switch: switch status { case Success: break case Failure(let message): println(message) }
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•