diff --git a/Shared/ErrorHandling/ErrorConstants.swift b/Shared/ErrorHandling/ErrorConstants.swift index 2962246..676f299 100644 --- a/Shared/ErrorHandling/ErrorConstants.swift +++ b/Shared/ErrorHandling/ErrorConstants.swift @@ -81,6 +81,21 @@ extension AccountError: LocalizedError { } } +// MARK: - User Defaults Errors + +enum UserDefaultsError: Error { + case couldNotMigrateStandardDefaults +} + +extension UserDefaultsError: LocalizedError { + public var errorDescription: String? { + switch self { + case .couldNotMigrateStandardDefaults: + return NSLocalizedString("Could not migrate user defaults to group container", comment: "") + } + } +} + // MARK: - Local Store Errors enum LocalStoreError: Error { diff --git a/Shared/Extensions/UserDefaults+Extensions.swift b/Shared/Extensions/UserDefaults+Extensions.swift index f40a824..b010fdc 100644 --- a/Shared/Extensions/UserDefaults+Extensions.swift +++ b/Shared/Extensions/UserDefaults+Extensions.swift @@ -17,17 +17,6 @@ enum WFDefaults { extension UserDefaults { - private enum DefaultsError: Error { - case couldNotMigrateStandardDefaults - - var description: String { - switch self { - case .couldNotMigrateStandardDefaults: - return "Could not migrate user defaults to group container." - } - } - } - private static let appGroupName: String = "group.com.abunchtell.writefreely" private static let didMigrateDefaultsToAppGroup: String = "didMigrateDefaultsToAppGroup" private static let didRemoveStandardDefaults: String = "didRemoveStandardDefaults" @@ -61,7 +50,7 @@ extension UserDefaults { groupDefaults.set(true, forKey: UserDefaults.didMigrateDefaultsToAppGroup) return groupDefaults } else { - throw DefaultsError.couldNotMigrateStandardDefaults + throw UserDefaultsError.couldNotMigrateStandardDefaults } }