mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-06-19 18:24:12 +08:00
Expand test coverage and fix situations where requests would unexpectedly initialize incorrectly without error
* RKObjectParameterization now returns an empty dictionary if mapping produces an unmappable representation error (no mappable attributes/relationships found) * Log errors if request construction results in an NSError and return nil * Ensure errors are passed back up through object parameterization instead of just returning nil * Reset the serialization MIME Type registry during RKTestFactory set up to ensure it is in a sane state * Convert Hamcrest matchers to Expecta in the object mapper tests to fix infinite recursion on test failure (will need to completely phase out Hamcrest soon)
This commit is contained in:
@@ -22,11 +22,11 @@
|
||||
|
||||
typedef UInt32 RKMappingErrorCode;
|
||||
enum {
|
||||
RKMappingErrorNotFound = 1001, // No mapping found
|
||||
RKMappingErrorTypeMismatch = 1002, // Target class and object mapping are in disagreement
|
||||
RKMappingErrorUnmappableContent = 1003, // No mappable attributes or relationships were found
|
||||
RKMappingErrorFromMappingResult = 1004, // The error was returned from the mapping result
|
||||
RKMappingErrorValidationFailure = 1005 // Generic error code for use when constructing validation errors
|
||||
RKMappingErrorNotFound = 1001, // No mapping found
|
||||
RKMappingErrorTypeMismatch = 1002, // Target class and object mapping are in disagreement
|
||||
RKMappingErrorUnmappableRepresentation = 1003, // No values were found at the key paths of any attribute or relationship mappings in the given representation
|
||||
RKMappingErrorFromMappingResult = 1004, // The error was returned from the mapping result
|
||||
RKMappingErrorValidationFailure = 1005 // Generic error code for use when constructing validation errors
|
||||
};
|
||||
|
||||
extern NSString * const RKMappingErrorKeyPathErrorKey; // The key path the error is associated with
|
||||
|
||||
@@ -604,8 +604,9 @@ NSDate *RKDateFromStringWithFormatters(NSString *dateString, NSArray *formatters
|
||||
RKLogError(@"Failed mapping operation: %@", [self.error localizedDescription]);
|
||||
} else {
|
||||
// We did not find anything to do
|
||||
RKLogDebug(@"Mapping operation did not find any mappable content");
|
||||
self.error = [NSError errorWithDomain:RKErrorDomain code:RKMappingErrorUnmappableContent userInfo:nil];
|
||||
RKLogDebug(@"Mapping operation did not find any mappable values for the attribute and relationship mappings in the given object representation");
|
||||
NSDictionary *userInfo = @{ NSLocalizedDescriptionKey: @"No mappable values found for any of the attributes or relationship mappings" };
|
||||
self.error = [NSError errorWithDomain:RKErrorDomain code:RKMappingErrorUnmappableRepresentation userInfo:userInfo];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user