Created
August 31, 2020 13:28
-
-
Save IvanovDeveloper/330e05bfbac10dcb120aa353e8d29ab3 to your computer and use it in GitHub Desktop.
LocalizedErros
This file contains hidden or 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 STRechabilityError: LocalizedError { | |
var errorDescription: String? { | |
switch self { | |
case .noInternetConnection: return "There is no internet connection" | |
} | |
} | |
} | |
extension STAuthenticationError: LocalizedError { | |
var errorDescription: String? { | |
switch self { | |
case .wrongEmail: | |
return "Wrong email address." | |
case .emailIsEmpty: | |
return "Email address is empty." | |
case .passwordIsEmpty: | |
return "Password is empty." | |
case .passwordShouldHasMinimum6Characters: | |
return "Password should has 6 characters minimum." | |
case .passwordMustMatch: | |
return "Repeat password isn't the same to password." | |
case .usernameIsEmpty: | |
return "Username is required." | |
case .fullnameIsEmpty: | |
return "Full name is required." | |
case .minimumAge: | |
return "The minimum age to use the app is 12." | |
case .birthDateIsEmpty: | |
return "Date of birth is required." | |
case .usernameShouldHasMinimum5Characters: | |
return "Username should has 5 characters minimum." | |
} | |
} | |
} | |
extension STCreateCrossStepError: LocalizedError { | |
var errorDescription: String? { | |
switch self { | |
case .crossStepAlreadyCreated: return "Cross step already created." | |
} | |
} | |
} | |
extension STAddCommunityToStepError: LocalizedError { | |
var errorDescription: String? { | |
switch self { | |
case .comunityIsNotSelected: return "Community was not selected, please select community." | |
} | |
} | |
} | |
struct STNetworkResponseError: Error { | |
/// It is error message which was provided by response if occured error in the request | |
let errorMessage: String | |
let error: Error? | |
} | |
extension STNetworkResponseError: LocalizedError { | |
var errorDescription: String? { | |
return errorMessage | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment