Exception handling

@interface IsNilException : NSException
@end

@interface IsEmptyException : NSException
@end

@implementation IsNilException : NSException
@end

@implementation IsEmptyException : NSException
@end

+(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 {
    [self throwWhenNilOrEmptyArray:nil];
}
@catch (NSException *exception) {
    NSLog(@"%@"@"Error happened");
}