Created
December 16, 2015 20:30
-
-
Save preble/7efde26fc55b1d0cf5c3 to your computer and use it in GitHub Desktop.
Adds a sort of localizedDescription to ErrorType.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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