Refactor spec errors management