This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ruby and the fly likes What is catch/throw ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Languages » Ruby
Bookmark "What is catch/throw ?" Watch "What is catch/throw ?" New topic
Author

What is catch/throw ?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hey,
In Ruby, begin/rescue/ensure are the equivalents for Java's try/catch/finally.
Ruby has catch/throw constructs, what are these?
Thanks.
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

http://ruby.activeventure.com/programmingruby/book/tut_exceptions.html
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

For all practical purposes, you'll probably never catch or throw. begin/rescue/end is primarily used and it's idiomatic in Ruby to simply return null or other default value from a method in *some cases* where Java would choose to throw an exception.


A good workman is known by his tools.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is catch/throw ?