Catch exception

hello guys

how to catch exceptions in RoR like java?

in java
try{
}
catch(Exception c)
{}

how to do that in RoR??
thanks

Look up the Ruby documentation for begin/rescue :slight_smile:

This is with java traduction (don’t know if it’s ok the java part :wink: )

begin # -> try{
raise “exception” # -> throw new Exception();
rescue # -> }catch(Exception e){
puts $! # -> System.out.println(e.toString());
end # -> }

good link:

http://phrogz.net/ProgrammingRuby/tut_exceptions.html

thanks guys, it works successfully (Y)