Skip to content
This repository was archived by the owner on Feb 8, 2023. It is now read-only.

Commit 50818cd

Browse files
committed
Don't restrict error to NSError
1 parent 1f7f843 commit 50818cd

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

CoreDataKit/NSManagedObjectContext.swift

+5-7
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ extension NSManagedObjectContext
8989
try self.obtainPermanentIDsForInsertedObjects()
9090
try self.save()
9191
completionHandler?(arg: { commitAction })
92-
} catch let error as NSError {
93-
completionHandler?(arg: { throw CoreDataKitError.CoreDataError(error) })
9492
} catch {
95-
fatalError()
93+
completionHandler?(arg: { throw CoreDataKitError.CoreDataError(error) })
9694
}
9795

9896
case .SaveToPersistentStore:
@@ -164,7 +162,7 @@ extension NSManagedObjectContext
164162
do {
165163
try self.obtainPermanentIDsForObjects(Array(self.insertedObjects))
166164
}
167-
catch let error as NSError {
165+
catch {
168166
throw CoreDataKitError.CoreDataError(error)
169167
}
170168
}
@@ -232,7 +230,7 @@ extension NSManagedObjectContext
232230
do {
233231
try self.obtainPermanentIDsForObjects([managedObject])
234232
}
235-
catch let error as NSError {
233+
catch {
236234
throw CoreDataKitError.CoreDataError(error)
237235
}
238236

@@ -292,7 +290,7 @@ extension NSManagedObjectContext
292290
let anyObjects = try executeFetchRequest(fetchRequest)
293291
return anyObjects.map { $0 as! T }
294292
}
295-
catch let error as NSError {
293+
catch {
296294
throw CoreDataKitError.CoreDataError(error)
297295
}
298296
}
@@ -356,7 +354,7 @@ extension NSManagedObjectContext
356354
let managedObjectInContext = try existingObjectWithID(managedObjectID)
357355
return managedObjectInContext as! T
358356
}
359-
catch let error as NSError {
357+
catch {
360358
throw CoreDataKitError.CoreDataError(error)
361359
}
362360
}

CoreDataKit/NSPersistentStoreCoordinator.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ extension NSPersistentStoreCoordinator
8383
do {
8484
try self.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: URL, options: options)
8585
}
86-
catch let error as NSError {
86+
catch {
8787
throw CoreDataKitError.CoreDataError(error)
8888
}
8989
}

0 commit comments

Comments
 (0)