+(void) throwWhenNilOrEmptyArray: (NSArray *) array {
if (array == nil) {
@throw [IsNilException
exceptionWithName:@"IsNilException"
reason:@"Array is nil"
userInfo:nil];
}
if (array.count == 0) {
@throw [IsEmptyException
exceptionWithName:@"IsEmptyException"
reason:@"Array is empty"
userInfo:nil];
}
}
@try {
NSArray *array = @[];
[self throwWhenNilOrEmptyArray:array];
}
@catch (IsNilException *e) {
NSLog(@"%@", @"array is not specified");
}
@catch (IsEmptyException *e) {
NSLog(@"%@", @"list is empty");
}