The Risk of Failure: Trial and Error Learning and Long-Run Performance