Use onError function when parsing ints to avoid exception handling