[swift-evolution] [Discussion] Adopting a new common error type outside the bounds of NSError
Dave Abrahams
dabrahams at apple.com
Mon Mar 7 10:23:58 CST 2016
on Sun Mar 06 2016, Charles Kissinger <swift-evolution at swift.org> wrote:
> Erica,
>
> I wouldn’t want a single, universal error type for the standard
> library. I would want to be able to selectively catch errors based on
> their type rather than having to look into the “reason” string to
> determine what happened. (In other words, the reason should be encoded
> in the error type.)
Are you sure? People often reflexively think they want strong static
typing in their errors, forgetting that error handling of the
throw/catch variety is fundamentally dynamically typed, effectively
introspecting the error at the catch site. Think about the use cases.
--
-Dave
More information about the swift-evolution
mailing list