Created
March 23, 2017 11:41
-
-
Save drinkius/4b451949308726034942d5d2cceb88c4 to your computer and use it in GitHub Desktop.
CustomNSError
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
@objc public enum AppContextError: Int, CustomStringConvertible, CustomNSError, LocalizedError { | |
case badParameters | |
case unknownError | |
case connectNotSupported | |
public static var errorDomain: String { | |
return "AppContextError" | |
} | |
public var errorCode: Int { | |
return rawValue | |
} | |
public var errorUserInfo: [String : Any] { | |
return ["ErrorDescription": description] | |
} | |
public var description: String { | |
switch self { | |
case .badParameters: | |
return "Bad parameters" | |
case .unknownError: | |
return "Unknown error" | |
case .connectNotSupported: | |
return "Platform does not support connect" | |
} | |
} | |
public var errorDescription: String? { | |
return description | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment