Skip to content

Commit df62063

Browse files
committed
Bolts doesnt infer failed tasks with NSError as a return type, always return failed tasks if needed
1 parent a56b2d4 commit df62063

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Parse/Parse/PFObject.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ + (BFTask *)_deepSaveAsyncChildrenOfObject:(id)object withCurrentUser:(PFUser *)
500500
[object _objectWillSave];
501501
NSError *error;
502502
if (![object _checkSaveParametersWithCurrentUser:currentUser error:&error]) {
503-
return error;
503+
return [BFTask taskWithError:error];
504504
}
505505
command = [object _constructSaveCommandForChanges:[object unsavedChanges]
506506
sessionToken:sessionToken
@@ -626,7 +626,7 @@ + (BFTask *)_enqueueSaveEventuallyChildrenOfObject:(PFObject *)object currentUse
626626
// We do cycle-detection when building the list of objects passed to this
627627
// function, so this should never get called. But we should check for it
628628
// anyway, so that we get an exception instead of an infinite loop.
629-
PFPrecondition(current.count != 0, @"Unable to save a PFObject with a relation to a cycle.");
629+
PFPreconditionWithTask(current.count != 0, @"Unable to save a PFObject with a relation to a cycle.");
630630

631631
// If a lazy user is one of the objects in the array, resolve its laziness now and
632632
// remove it from the list of things to save.
@@ -1467,7 +1467,7 @@ - (BFTask *)saveAsync:(BFTask *)toAwait {
14671467
return [[childrenTask continueWithSuccessBlock:^id(BFTask *task) {
14681468
NSError *error;
14691469
if (![self _checkSaveParametersWithCurrentUser:currentUser error:&error]) {
1470-
return error;
1470+
return [BFTask taskWithError:error];
14711471
}
14721472
PFRESTCommand *command = [self _constructSaveCommandForChanges:changes
14731473
sessionToken:sessionToken

Parse/Parse/PFUser.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ - (BFTask *)signUpAsync:(BFTask *)toAwait {
509509
// self doesn't have any outstanding saves, so we can safely merge its operations
510510
// into the current user.
511511

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

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

0 commit comments

Comments
 (0)