Skip to content

Commit

Permalink
Modify save to capture save errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielctull committed Jan 12, 2011
1 parent 11f8eab commit 3c86a3e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion NSManagedObjectContext+DCTExtras.m
Expand Up @@ -44,7 +44,24 @@ - (NSManagedObjectModel *)dct_managedObjectModel {
}

- (BOOL)dct_save {
return [self save:nil];

NSError *error = nil;

BOOL saved = [self save:&error];
if (!saved) {

NSLog(@"Save failed: %@", [error localizedDescription]);

NSArray* detailedErrors = [[error userInfo] objectForKey:NSDetailedErrorsKey];

if(detailedErrors != nil && [detailedErrors count] > 0) {
for(NSError* detailedError in detailedErrors) {
NSLog(@" DetailedError: %@", [detailedError userInfo]);
}
}
}

return saved;
}

@end

0 comments on commit 3c86a3e

Please sign in to comment.