Xcode-beta (7A120f): Add support for try support for guard statements
| Originator: | owensd | ||
| Number: | rdar://21359273 | Date Originated: | 12-Jun-2015 09:43 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode-beta (7A120f) |
| Classification: | Enhancement | Reproducible: | Always |
The current syntax for handling errors can be really cumbersome, especially for one-line catch-all type errors, such as:
do {
try canThrow()
}
catch {
fatalError("bad mojo")
}
It would be really great if we could use the guard statement to clean this code up.
guard try canThrow() else { fatalError("bad mojo") }
guard let f = try canThrowReturns() else { fatalError("bad mojo") }
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!