refactor for errors partial