Skip to content

Instantly share code, notes, and snippets.

@preble
Created December 16, 2015 20:30
Show Gist options
  • 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