[swift-evolution] [Discussion] Adopting a new common error type outside the bounds of NSError

Brent Royal-Gordon brent at architechies.com
Sun Mar 6 21:47:15 CST 2016

> I was suggesting something that was a standard fallback 
> error completely separate from any other modification to the error mechanism, just because it's extremely useful
> to have something to throw without having to design a full error system for things like command-line utilities, etc.
> In otherwords, a pre-constructed vanilla handy-error, ready for use that would have zero impact on any other error
> system, implementation, or mechanism.


If that's what you have in mind, I would give it a name like SimpleError, GenericError, or UnspecifiedError, and I would not have it carry any state other than an error message (if we introduce some standard mechanism to convey an error message, like using CustomStringConvertible). I think that, at the point where you need to pack a generic error full of random information or figure out where in the source code it came from, you probably need to start explicitly modeling the errors your code can generate.

Brent Royal-Gordon

More information about the swift-evolution mailing list