Study the weather carefully before you go, pack appropriately, have a plan for escaping, and have a means of communicating with someone on the ground. Don't believe people when they tell you “It never rains in Yosemite,” because it does.
Sometimes it snows for days during prime climbing season. Understand before you leave the ground that you might have to bivy, climb and/or rappel in a frigid, wind-whipped waterfall before you make it back down.
We can never be prepared for every contingency, but take the time to work out as many details as possible and never underestimate the forces of nature.
In mid-October 2004 two Japanese climbers died high on The Nose of El Capitan, Yosemite, California, USA.
You can read a recent Yosemite Search and Rescue analysis of this tragedy here at www.friendsofyosar.org