In Swift 2.0 NSError conforms to the ErrorType protocol.

For a customly defined error, we can specify the associating object(s) for some cases, like below.

enum LifeError: ErrorType { case BeBorn case LostJob(job: String) case GetCaughtByWife(wife: String) ... }

We can comfortably do the following:

do { try haveAffairWith(otherPerson) } catch LifeError.GetCaughtByWife(let wife) { ... }

However if we want it to pass into other places as an NSError , it loses its associating object information.

println("\(LifeError.GetCaughtByWife("Name") as NSError)")

prints:

Error Domain=... Code=1 "The operation couldn't be completed". (... error 1)

and its userInfo is nil .