Refactor some exception handling and extract a method.