Refactoring errors handling