[swift-evolution] [Proposal draft] NSError bridging
Paul Cantrell
cantrell at pobox.com
Wed Jun 29 17:30:02 CDT 2016
> On Jun 27, 2016, at 1:17 PM, Douglas Gregor via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>
> The LocalizedError protocol describes an error that provides localized messages for display to the end user, all of which provide default implementations. The conforming type can provide implementations for any subset of these requirements:
>
> protocol LocalizedError : Error {
> /// A localized message describing what error occurred.
> var errorDescription: String? { get }
> …
> }
Given that LocalizedError would now be its own protocol that not all errors would conform to, could errorDescription be non-optional?
> var errorDescription: String { get }
It would be nice if conformance to LocalizedError guaranteed the presence of a user-readable message. Such a guarantee is useful when building a UI.
I realize the bridging to NSError may make this impossible, but in principle it seems like the right design.
Cheers,
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160629/34b2b199/attachment.html>
More information about the swift-evolution
mailing list