Created
May 9, 2016 21:51
-
-
Save benjaminsnorris/8c6a05271a62f276fdf939c8f407ed2e to your computer and use it in GitHub Desktop.
Add default text to all errors
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 { | |
// MARK: - Internal functions | |
func describe() -> String { | |
if let error = self as? CustomStringConvertible { | |
return error.description | |
} else { | |
let error = self as NSError | |
return error.localizedDescription | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment