[swift-evolution] [swift-users] Every non-trivial Swift function should throw, right?

Erica Sadun erica at ericasadun.com
Sun Mar 6 00:14:45 CST 2016


Wrong list for language discussions, but domain/code/userInfo aren't really Swifty.
It feels like we're tied down to a archaic construct just for the sake of consistency.

An error should answer the following questions:

* What went wrong?
* Where did it go wrong?
* What other information am I passing along about the circumstances of the error?

Which ties into my reason/context/errorInfo over domain/code/userInfo.

-- E, who has replaced -users with -evolution in the reply


> On Mar 5, 2016, at 11:02 PM, Dave Abrahams via swift-users <swift-users at swift.org> wrote:
> 
> 
> on Sat Mar 05 2016, Erica Sadun <swift-users-AT-swift.org> wrote:
> 
>> I'm hopping in here ridiculously late, but wasn't someone going to
>> propose a vanilla universal stdlib error type along the lines of
>> 
>> struct Error: ErrorType {
>>   let reason: String
>> }
>> 
>> (preferably with auto-captured location context
>> (http://ericasadun.com/2015/08/27/capturing-context-swiftlang/
>> <http://ericasadun.com/2015/08/27/capturing-context-swiftlang/>) and a
>> custom mutable dictionary.)
> 
> I know some people around here really want us to standardize on NSError
> for this purpose.  If you have good reasons why we shouldn't, now would
> be a good time to develop those arguments.
> 
> -- 
> -Dave
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160305/701a0a18/attachment.html>


More information about the swift-evolution mailing list