Created
July 13, 2014 21:13
-
-
Save davidpdrsn/6f682877768a076196a7 to your computer and use it in GitHub Desktop.
Core Data error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pragma mark - validation | |
| - (BOOL)validateForInsert:(NSError *__autoreleasing *)error { | |
| NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init]; | |
| [userInfo setObject:@"Cannot add more than 10 moves" forKey:NSLocalizedFailureReasonErrorKey]; | |
| [userInfo setObject:self forKey:NSValidationObjectErrorKey]; | |
| NSError *tooManyMovesError = [NSError errorWithDomain:@"TenMovesDomain" code:NSManagedObjectValidationError userInfo:userInfo]; | |
| if (*error == nil) { | |
| *error = tooManyMovesError; | |
| } else { | |
| *error = [NSError errorFromOriginalError:*error error:tooManyMovesError]; | |
| } | |
| return NO; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment