try-catch refactor.