improve exception handling
This commit is contained in:
parent
e89c10daae
commit
30d4c7730f
@ -141,9 +141,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (id)initializerClassCheck:(nullable NSObject *)object classToVerify:(Class)classToVerify {
|
+ (id)initializerClassCheck:(nullable NSObject *)object classToVerify:(Class)classToVerify {
|
||||||
if (object) {
|
if (!object) { return nil; }
|
||||||
[self classIsInstanceTypeOfClass:object.class otherClass:classToVerify throwException:YES];
|
if (!object.class) {
|
||||||
|
@throw([NSException exceptionWithName:@"NoClass" reason:[NSString stringWithFormat:@"Object %@ is missing class %@", object, object.class] userInfo:nil]);
|
||||||
}
|
}
|
||||||
|
if (![self classIsInstanceTypeOfClass:object.class otherClass:classToVerify throwException:YES]) { return nil; }
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user