William Hazlitt said this quote

Danger is a good teacher, and makes apt scholars. So are disgrace, defeat, exposure to immediate scorn and laughter. There is no opportunity in such cases for self-delusion, no idling time away, no being off your guard (or you must take the consequences) - neither is there any room for humour or caprice or prejudice.