Failure is highly necessary to learn, but it is also extremely important that the material and the teachers/mentors build the correct atmosphere/mindset for learning from faults.
If you have anything to do with mentoring/teaching other people (and that is why you are here, right?), please read this short article and take the lesson to heart.
The first fractions of a second after a failure actually determine how you will learn from the error, so the mindset has to be there before the failure. Just a slight change in wording can mean a lot for how a whole class will learn from their errors.