Skip to content

Commit

Permalink
Bolts doesnt infer failed tasks with NSError as a return type, always…
Browse files Browse the repository at this point in the history
… return failed tasks if needed
  • Loading branch information
flovilmart committed Jan 21, 2018
1 parent a56b2d4 commit df62063
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Parse/Parse/PFObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ + (BFTask *)_deepSaveAsyncChildrenOfObject:(id)object withCurrentUser:(PFUser *)
[object _objectWillSave];
NSError *error;
if (![object _checkSaveParametersWithCurrentUser:currentUser error:&error]) {
return error;
return [BFTask taskWithError:error];
}
command = [object _constructSaveCommandForChanges:[object unsavedChanges]
sessionToken:sessionToken
Expand Down Expand Up @@ -626,7 +626,7 @@ + (BFTask *)_enqueueSaveEventuallyChildrenOfObject:(PFObject *)object currentUse
// We do cycle-detection when building the list of objects passed to this
// function, so this should never get called. But we should check for it
// anyway, so that we get an exception instead of an infinite loop.
PFPrecondition(current.count != 0, @"Unable to save a PFObject with a relation to a cycle.");
PFPreconditionWithTask(current.count != 0, @"Unable to save a PFObject with a relation to a cycle.");

// If a lazy user is one of the objects in the array, resolve its laziness now and
// remove it from the list of things to save.
Expand Down Expand Up @@ -1467,7 +1467,7 @@ - (BFTask *)saveAsync:(BFTask *)toAwait {
return [[childrenTask continueWithSuccessBlock:^id(BFTask *task) {
NSError *error;
if (![self _checkSaveParametersWithCurrentUser:currentUser error:&error]) {
return error;
return [BFTask taskWithError:error];
}
PFRESTCommand *command = [self _constructSaveCommandForChanges:changes
sessionToken:sessionToken
Expand Down
2 changes: 1 addition & 1 deletion Parse/Parse/PFUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ - (BFTask *)signUpAsync:(BFTask *)toAwait {
// self doesn't have any outstanding saves, so we can safely merge its operations
// into the current user.

PFPrecondition(!self._current, @"Attempt to merge currentUser with itself.");
PFPreconditionWithTask(!self._current, @"Attempt to merge currentUser with itself.");

@synchronized ([currentUser lock]) {
NSString *oldUsername = [currentUser.username copy];
Expand Down

0 comments on commit df62063

Please sign in to comment.