Skip to content

Instantly share code, notes, and snippets.

@preble
Created December 16, 2015 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save preble/7efde26fc55b1d0cf5c3 to your computer and use it in GitHub Desktop.
Save preble/7efde26fc55b1d0cf5c3 to your computer and use it in GitHub Desktop.
Adds a sort of localizedDescription to ErrorType.
extension ErrorType {
var myLocalizedDescription: String {
if self.dynamicType == NSError.self {
return ((self as Any) as! NSError).localizedDescription
}
else {
return "\(self)"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment