Catching exceptions in genetic algorithm