-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added custom error for open rules (#10)
added localized error added different format for dates fixed value for scheme added max version for rule selection Co-authored-by: Alexandr Chernyy <pingus.nikalex@gmail.com>
- Loading branch information
1 parent
af68fec
commit a4b10d4
Showing
7 changed files
with
251 additions
and
46 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Alexandr Chernyy on 29.06.2021. | ||
// | ||
"unknown_error" = "An unexpected error occurred"; | ||
"recheck_rule" = "Check Re-open EU for further details and travel-related rules"; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Alexandr Chernyy on 29.06.2021. | ||
// | ||
|
||
import Foundation | ||
|
||
enum CertLogicError: Error { | ||
// Throw when an schemeversion not valid | ||
case openState | ||
// Throw in all other cases | ||
case unexpected(code: Int) | ||
} | ||
|
||
extension CertLogicError: CustomStringConvertible { | ||
public var description: String { | ||
switch self { | ||
case .openState: | ||
return NSLocalizedString( | ||
"recheck_rule", | ||
comment: "Invalid Password" | ||
) | ||
case .unexpected(_): | ||
return NSLocalizedString( | ||
"unknown_error", | ||
comment: "Unexpected Error") | ||
} | ||
} | ||
} | ||
|
||
extension CertLogicError: LocalizedError { | ||
public var errorDescription: String? { | ||
switch self { | ||
case .openState: | ||
return NSLocalizedString( | ||
"recheck_rule", | ||
comment: "Invalid Password" | ||
) | ||
case .unexpected(_): | ||
return NSLocalizedString( | ||
"unknown_error", | ||
comment: "Unexpected Error") | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.