27 Jan '14, 4pm

Time for our daily reminder. DON'T rescue Exception!!

Rescue StandardError, Not Exception Jon Yurek November 18, 2013 ruby Sometimes our Ruby programs throw errors which we don't have full control over, such as network timeouts. So, we need to catch and handle those errors. To do so, we need to choose an Exception -descended class (or classes) to catch. What's the right granularity of that class? The rescued class must descend from Exception Ruby's Exception class hierarchy starts with Exception . If we try to raise an object that is not an Exception , Ruby complains. begin raise 1234.0 rescue => error puts error.inspect end Results in: #<TypeError: exception class/object expected> The default is StandardError By default, rescue only catches things that are StandardError s. To rescue something that isn't a StandardError , we have to specify: begin raise Exception.new rescue Exception => error puts "Correct!" end Results in: C...

Full article: http://robots.thoughtbot.com/rescue-standarderror-not-exc...

Tweets

SeaWorld only spends 0.0006 percent of revenue ...

grist.org 27 Jan '14, 3pm

HELLZ NO, Zimmermann basically says, explaining that SeaWorld’s contributions to animal rescue and rehab only amount to .0...

[email protected] only spends 0.0006 percent of revenu...

grist.org 27 Jan '14, 3pm

HELLZ NO, Zimmermann basically says, explaining that SeaWorld’s contributions to animal rescue and rehab only amount to .0...

U.S. will be ready to rescue Americans from Soc...

marinecorpstimes.com 25 Jan '14, 7pm

Defense Secretary Chuck Hagel told reporters Friday that the United States will be ready to remove Americans from Sochi in...

U.S. will be ready to rescue Americans from Soc...

navytimes.com 25 Jan '14, 7pm

Defense Secretary Chuck Hagel told reporters Friday that the United States will be ready to remove Americans from Sochi in...

U.S. will be ready to rescue Americans from Soc...

militarytimes.com 25 Jan '14, 6pm

Defense Secretary Chuck Hagel told reporters Friday that the United States will be ready to remove Americans from Sochi in...

Learn about how QR codes can save lives, and how to get one for your MB from 1990 onward. > < http…

Learn about how QR codes can save lives, and ho...

mercedes-benz.com 04 Feb '14, 12am

Often, every second counts in an accident. To help the rescuers at the scene, Mercedes-Benz is now the first ever automoti...