Add helpful error message if you call requestMapping on an RKObjectMapping subclass

This commit is contained in:
Blake Watters
2013-01-06 01:11:09 -05:00
parent 0d74946808
commit 7f8320c514
3 changed files with 22 additions and 2 deletions

View File

@@ -115,8 +115,15 @@ static RKSourceToDesinationKeyTransformationBlock defaultSourceToDestinationKeyT
return [[self alloc] initWithClass:objectClass];
}
+ (instancetype)requestMapping
+ (RKObjectMapping *)requestMapping
{
if (! [self isEqual:[RKObjectMapping class]]) {
@throw [NSException exceptionWithName:NSInternalInconsistencyException
reason:[NSString stringWithFormat:@"`%@` is not meant to be invoked on `%@`. You probably want to invoke `[RKObjectMapping requestMapping]`.",
NSStringFromSelector(_cmd),
NSStringFromClass(self)]
userInfo:nil];
}
return [self mappingForClass:[NSMutableDictionary class]];
}