adding "hooks" for fail() and process.exit()

These can now be changed in subclasses.