I created a simple core data project and added a function that would fetch records of an entity named "Task"
I purposley gave a wrong name for the Entity's field so it would throw an error. I would expect that the error would be "caught" by the exaustive catch as you can see below.
Actually the executeFetchRequest method does fail and I get an error print-out at the console output, but the catch closure is not getting called.
Here is the code:
let request = NSFetchRequest(entityName: "Task")
let predicate = NSPredicate(format: "priasdfority_ == %i", 1)
request.predicate = predicate
do{
let results = try self.managedObjectContext.executeFetchRequest(request)
print(results)
}catch{
print("There was an error")
print(error)
}
Is there something wrong with the code, or am I failing to grasp how the new error handling works ?