Error field penetration in the presence of diamagnetic effects