Added exitOnError option.