Add terminateScriptOnError function. Experiment with part of install script.