Added exitOnError flag