Exception handling in Ruby
Posted by tom March 21st, 2006
Ofcourse Exceptions handling is not new, but I just would love to write code like the following:
begin
loc = Location.find_by_name("NL-ELC")
@lp.move(loc)
rescue LicenseplateLocationException => lple
print "Licenseplate not for your location: " + lple
rescue StockException => se
print "Not enough stock: " + se
end
Currently my employer’s error handling is like such:
IF( theErrorMessage = "" ) THEN GOSUB moveLP END ELSE CRT "Error!" END

June 6th, 2007 at 11:49 AM
i am new in working with exception handling in ruby. I want to know how can i use customised exception handling in ruby.if one example u can show??