Remove exit(..) calls and replace by raising a runtime exception to Ruby.