Throw an exception instead of calling process.exit()