Originally discussed here https://github.com/h2oai/h2o-3/pull/4114#discussion_r352644226
Comment from :
this legacy catch (IllegalArgumentException e) looks so nasty with the nested catch (RuntimeException e) inside.
I'm sure its scope should have been limited to params = it.nextModelParameters(model);, avoiding you to have to handle numberOfBuiltModels-- multiple times.
In worst case scenario — let's imagine grid.appendFailedModelParameters throws an IllegalArgumentException — the counter will be decremented twice.