Refactor validate error as a protocol callback