refactoring exception variable declaration