When I think about learning from failure in the classroom I think one of the methods to do this is to incorporate more assessment for learning as opposed to assessment of learning. The former is an opportunity for learners to learn from their failures consequence free where the later failure has negative consequences (poor marks).
Here is a TED talk by Allan Savory that talks about learning through failure. What makes this talk worth listening to for me is that while the failure Allan experienced had very significant negative consequences for the environment it also was the catalyst for him, and society, to come to a deeper understanding and solution for the original problem he was trying to solve.