Skip to content

Commit 0006666

Browse files
committed
Fixed wrong exception from Keychain
1 parent 04fa9d0 commit 0006666

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Sources/SwiftSQLite/Database+Keychain.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ internal struct KeychainItem {
4444

4545
public enum KeychainError: Error {
4646
case noPassword
47-
case unexpectedPasswordData
4847
case unexpectedItemData
4948
case unhandledError
5049
}
@@ -92,15 +91,15 @@ internal struct KeychainItem {
9291
guard let existingItem = queryResult as? [String: AnyObject],
9392
let passwordData = existingItem[kSecValueData as String] as? Data
9493
else {
95-
throw KeychainError.unexpectedPasswordData
94+
throw KeychainError.noPassword
9695
}
9796

9897
return passwordData
9998
}
10099

101100
public func readItem() throws -> String {
102101
guard let password = String(data: try readItemData(), encoding: String.Encoding.utf8) else {
103-
throw KeychainError.unexpectedPasswordData
102+
throw KeychainError.noPassword
104103
}
105104
return password
106105
}

0 commit comments

Comments
 (0)