25
25
@implementation PFFieldOperation
26
26
27
27
- (id )encodeWithObjectEncoder : (PFEncoder *)objectEncoder {
28
- PFConsistencyAssert ( NO , @" Operation is invalid." );
28
+ PFConsistencyAssertionFailure ( @" Operation is invalid." );
29
29
return nil ;
30
30
}
31
31
32
32
- (PFFieldOperation *)mergeWithPrevious : (PFFieldOperation *)previous {
33
- PFConsistencyAssert ( NO , @" Operation is invalid." );
33
+ PFConsistencyAssertionFailure ( @" Operation is invalid." );
34
34
return nil ;
35
35
}
36
36
37
37
- (id )applyToValue : (id )oldValue forKey : (NSString *)key {
38
- PFConsistencyAssert ( NO , @" Operation is invalid." );
38
+ PFConsistencyAssertionFailure ( @" Operation is invalid." );
39
39
return nil ;
40
40
}
41
41
@@ -153,7 +153,7 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
153
153
withNumber: ((PFIncrementOperation *)previous).amount];
154
154
return [PFIncrementOperation incrementWithAmount: newAmount];
155
155
}
156
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
156
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
157
157
return nil ;
158
158
}
159
159
@@ -208,15 +208,15 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
208
208
NSArray *newArray = [oldArray arrayByAddingObjectsFromArray: self .objects];
209
209
return [PFSetOperation setWithValue: newArray];
210
210
} 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." ) ;
212
212
return nil ;
213
213
}
214
214
} else if ([previous isKindOfClass: [PFAddOperation class ]]) {
215
215
NSMutableArray *newObjects = [((PFAddOperation *)previous).objects mutableCopy ];
216
216
[newObjects addObjectsFromArray: self .objects];
217
217
return [[self class ] addWithObjects: newObjects];
218
218
}
219
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
219
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
220
220
return nil ;
221
221
}
222
222
@@ -226,7 +226,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
226
226
} else if ([oldValue isKindOfClass: [NSArray class ]]) {
227
227
return [((NSArray *)oldValue)arrayByAddingObjectsFromArray:self .objects];
228
228
}
229
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
229
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
230
230
return nil ;
231
231
}
232
232
@@ -267,14 +267,14 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
267
267
NSArray *oldArray = (((PFSetOperation *)previous).value );
268
268
return [PFSetOperation setWithValue: [self applyToValue: oldArray forKey: nil ]];
269
269
} 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." ) ;
271
271
return nil ;
272
272
}
273
273
} else if ([previous isKindOfClass: [PFAddUniqueOperation class ]]) {
274
274
NSArray *previousObjects = ((PFAddUniqueOperation *)previous).objects ;
275
275
return [[self class ] addUniqueWithObjects: [self applyToValue: previousObjects forKey: nil ]];
276
276
}
277
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
277
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
278
278
return nil ;
279
279
}
280
280
@@ -302,7 +302,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
302
302
}
303
303
return newValue;
304
304
}
305
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
305
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
306
306
return nil ;
307
307
}
308
308
@@ -336,22 +336,22 @@ - (PFFieldOperation *)mergeWithPrevious:(PFFieldOperation *)previous {
336
336
if (!previous) {
337
337
return self;
338
338
} 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." ) ;
340
340
return nil ;
341
341
} else if ([previous isKindOfClass: [PFSetOperation class ]]) {
342
342
if ([((PFSetOperation *)previous).value isKindOfClass: [NSArray class ]]) {
343
343
NSArray *oldArray = ((PFSetOperation *)previous).value ;
344
344
return [PFSetOperation setWithValue: [self applyToValue: oldArray forKey: nil ]];
345
345
} 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." ) ;
347
347
return nil ;
348
348
}
349
349
} else if ([previous isKindOfClass: [PFRemoveOperation class ]]) {
350
350
NSArray *newObjects = [((PFRemoveOperation *)previous).objects arrayByAddingObjectsFromArray: self .objects];
351
351
return [PFRemoveOperation removeWithObjects: newObjects];
352
352
}
353
353
354
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
354
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
355
355
return nil ;
356
356
}
357
357
@@ -379,7 +379,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
379
379
}
380
380
return newValue;
381
381
}
382
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
382
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
383
383
return nil ;
384
384
}
385
385
@@ -474,8 +474,7 @@ - (id)encodeWithObjectEncoder:(PFEncoder *)objectEncoder {
474
474
if (removeDict) {
475
475
return removeDict;
476
476
}
477
-
478
- [NSException raise: NSInternalInconsistencyException format: @" A PFRelationOperation was created without any data." ];
477
+ PFConsistencyAssertionFailure (@" A PFRelationOperation was created without any data." );
479
478
return nil ;
480
479
}
481
480
@@ -535,7 +534,7 @@ - (id)applyToValue:(id)oldValue forKey:(NSString *)key {
535
534
}
536
535
}
537
536
} else {
538
- [ NSException raise: NSInternalInconsistencyException format: @" Operation is invalid after previous operation." ] ;
537
+ PFConsistencyAssertionFailure ( @" This operation is invalid after previous operation." ) ;
539
538
return nil ;
540
539
}
541
540
0 commit comments