Skip to content

Commit 756b507

Browse files
Updated missing file handlers to be simpler
Fixes #229
1 parent dcc132b commit 756b507

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Sources/CodableDatastore/Persistence/Disk Persistence/DiskPersistence.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ extension DiskPersistence {
144144

145145
cachedStoreInfo = storeInfo
146146
return storeInfo
147-
} catch URLError.fileDoesNotExist, CocoaError.fileReadNoSuchFile {
148-
return StoreInfo(modificationDate: Date())
149-
} catch let error as NSError where error.domain == NSPOSIXErrorDomain && error.code == Int(POSIXError.ENOENT.rawValue) {
147+
} catch URLError.fileDoesNotExist, CocoaError.fileNoSuchFile, CocoaError.fileReadNoSuchFile, POSIXError.ENOENT {
150148
return StoreInfo(modificationDate: Date())
151149
} catch {
152150
throw error

Sources/CodableDatastore/Persistence/Disk Persistence/Snapshot/Snapshot.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ extension Snapshot {
112112

113113
cachedManifest = manifest
114114
return manifest
115-
} catch URLError.fileDoesNotExist, CocoaError.fileReadNoSuchFile {
116-
return SnapshotManifest(id: id, modificationDate: Date())
117-
} catch let error as NSError where error.domain == NSPOSIXErrorDomain && error.code == Int(POSIXError.ENOENT.rawValue) {
115+
} catch URLError.fileDoesNotExist, CocoaError.fileNoSuchFile, CocoaError.fileReadNoSuchFile, POSIXError.ENOENT {
118116
return SnapshotManifest(id: id, modificationDate: Date())
119117
} catch {
120118
throw error

0 commit comments

Comments
 (0)