refactor logging functions

This commit is contained in:
John Rommel Estropia
2015-02-28 11:32:41 +09:00
parent 59cd505dc6
commit 55dee6ec2f
11 changed files with 151 additions and 118 deletions

View File

@@ -58,7 +58,9 @@ public extension NSManagedObjectContext {
}
if fetchResults == nil {
HardcoreData.handleError(error!, "Failed executing fetch request.")
HardcoreData.handleError(
error ?? NSError(hardcoreDataErrorCode: .UnknownError),
"Failed executing fetch request.")
return nil
}
@@ -90,7 +92,9 @@ public extension NSManagedObjectContext {
}
if fetchResults == nil {
HardcoreData.handleError(error!, "Failed executing fetch request.")
HardcoreData.handleError(
error ?? NSError(hardcoreDataErrorCode: .UnknownError),
"Failed executing fetch request.")
return nil
}
@@ -120,7 +124,9 @@ public extension NSManagedObjectContext {
}
if count == NSNotFound {
HardcoreData.handleError(error!, "Failed executing fetch request.")
HardcoreData.handleError(
error ?? NSError(hardcoreDataErrorCode: .UnknownError),
"Failed executing fetch request.")
return 0
}