Changed exit to throw a new Exception