WIP: prevent error when adding non-existent file

This commit is contained in:
John Rommel Estropia
2016-03-07 07:35:55 +09:00
parent 75a4ebb49b
commit 34495d7163

View File

@@ -282,9 +282,12 @@ public extension DataStack {
options: storage.storeOptions
)
}
catch let error as NSError where error.code == NSFileReadNoSuchFileError && error.domain == NSCocoaErrorDomain {
return []
}
catch {
// TODO: throws when file not exists yet
CoreStore.handleError(
error as NSError,
"Failed to load \(typeName(storage)) metadata from URL \"\(fileURL)\"."