[swift-evolution] [Proposal idea] Improved interop for ErrorType->NSError
Paul Cantrell
cantrell at pobox.com
Wed Dec 23 09:10:37 CST 2015
Well … obviously. It’s a toy example. The point was the nested conditionals, not the method.
P
> On Dec 23, 2015, at 12:12 AM, Thorsten Seitz <tseitz42 at icloud.com> wrote:
>
> I find it a little bit strange that your error handling function takes an optional in the first place.
> The caller should only call an errror handler in case of an error, so you should already have unwrapped the optional.
>
> -Thorsten
>
> Am 22.12.2015 um 18:30 schrieb Paul Cantrell via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:
>
>> func handleFileNotFound(error: ErrorType?)
>> {
>> if let error = error
>> {
>> if case MyError.FileNotFound(let url) = error
>> { print(url) }
>> }
>> }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151223/f770d922/attachment.html>
More information about the swift-evolution
mailing list