2525@implementation PFFieldOperation
2626
2727- (id )encodeWithObjectEncoder : (PFEncoder *)objectEncoder {
28- PFConsistencyAssert ( NO , @" Operation is invalid." );
28+ PFConsistencyAssertionFailure ( @" Operation is invalid." );
2929 return nil ;
3030}
3131
3232- (PFFieldOperation *)mergeWithPrevious : (PFFieldOperation *)previous {
33- PFConsistencyAssert ( NO , @" Operation is invalid." );
33+ PFConsistencyAssertionFailure ( @" Operation is invalid." );
3434 return nil ;
3535}
3636
3737- (id )applyToValue : (id )oldValue forKey : (NSString *)key {
38- PFConsistencyAssert ( NO , @" Operation is invalid." );
38+ PFConsistencyAssertionFailure ( @" Operation is invalid." );
3939 return nil ;
4040}
4141
@@ -153,7 +153,7 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
153153 withNumber: ((PFIncrementOperation *)previous).amount];
154154 return [PFIncrementOperation incrementWithAmount: newAmount];
155155 }
156- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
156+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
157157 return nil ;
158158}
159159
@@ -208,15 +208,15 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
208208 NSArray *newArray = [oldArray arrayByAddingObjectsFromArray: self .objects];
209209 return [PFSetOperation setWithValue: newArray];
210210 } else {
211- [ NSException raise: NSInternalInconsistencyException format: @" You can't add an item to a non-array." ] ;
211+ PFConsistencyAssertionFailure ( @" Unable to add an item to a non-array." ) ;
212212 return nil ;
213213 }
214214 } else if ([previous isKindOfClass: [PFAddOperation class ]]) {
215215 NSMutableArray *newObjects = [((PFAddOperation *)previous).objects mutableCopy ];
216216 [newObjects addObjectsFromArray: self .objects];
217217 return [[self class ] addWithObjects: newObjects];
218218 }
219- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
219+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
220220 return nil ;
221221}
222222
@@ -226,7 +226,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
226226 } else if ([oldValue isKindOfClass: [NSArray class ]]) {
227227 return [((NSArray *)oldValue)arrayByAddingObjectsFromArray:self .objects];
228228 }
229- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
229+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
230230 return nil ;
231231}
232232
@@ -267,14 +267,14 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
267267 NSArray *oldArray = (((PFSetOperation *)previous).value );
268268 return [PFSetOperation setWithValue: [self applyToValue: oldArray forKey: nil ]];
269269 } else {
270- [ NSException raise: NSInternalInconsistencyException format: @" You can't add an item to a non-array." ] ;
270+ PFConsistencyAssertionFailure ( @" Unable to add an item to a non-array." ) ;
271271 return nil ;
272272 }
273273 } else if ([previous isKindOfClass: [PFAddUniqueOperation class ]]) {
274274 NSArray *previousObjects = ((PFAddUniqueOperation *)previous).objects ;
275275 return [[self class ] addUniqueWithObjects: [self applyToValue: previousObjects forKey: nil ]];
276276 }
277- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
277+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
278278 return nil ;
279279}
280280
@@ -302,7 +302,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
302302 }
303303 return newValue;
304304 }
305- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
305+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
306306 return nil ;
307307}
308308
@@ -336,22 +336,22 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
336336 if (!previous) {
337337 return self;
338338 } else if ([previous isKindOfClass: [PFDeleteOperation class ]]) {
339- [ NSException raise: NSInternalInconsistencyException format: @" You can't remove items from a deleted array." ] ;
339+ PFConsistencyAssertionFailure ( @" Unable to remove items from a deleted array." ) ;
340340 return nil ;
341341 } else if ([previous isKindOfClass: [PFSetOperation class ]]) {
342342 if ([((PFSetOperation *)previous).value isKindOfClass: [NSArray class ]]) {
343343 NSArray *oldArray = ((PFSetOperation *)previous).value ;
344344 return [PFSetOperation setWithValue: [self applyToValue: oldArray forKey: nil ]];
345345 } else {
346- [ NSException raise: NSInternalInconsistencyException format: @" You can't add an item to a non-array." ] ;
346+ PFConsistencyAssertionFailure ( @" Unable to add an item to a non-array." ) ;
347347 return nil ;
348348 }
349349 } else if ([previous isKindOfClass: [PFRemoveOperation class ]]) {
350350 NSArray *newObjects = [((PFRemoveOperation *)previous).objects arrayByAddingObjectsFromArray: self .objects];
351351 return [PFRemoveOperation removeWithObjects: newObjects];
352352 }
353353
354- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
354+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
355355 return nil ;
356356}
357357
@@ -379,7 +379,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
379379 }
380380 return newValue;
381381 }
382- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
382+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
383383 return nil ;
384384}
385385
@@ -474,8 +474,7 @@ - (id)encodeWithObjectEncoder:(PFEncoder *)objectEncoder {
474474 if (removeDict) {
475475 return removeDict;
476476 }
477-
478- [NSException raise: NSInternalInconsistencyException format: @" A PFRelationOperation was created without any data." ];
477+ PFConsistencyAssertionFailure (@" A PFRelationOperation was created without any data." );
479478 return nil ;
480479}
481480
@@ -535,7 +534,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
535534 }
536535 }
537536 } else {
538- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
537+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
539538 return nil ;
540539 }
541540
0 commit comments