Refactoring syntax exceptions