Add spec coverage for error