Exception Handling

Hello,

I have a basic idea of what an exception is but I am not able to
understand it so that I can make use of it in my application’s.
If possible please try and help me out with the basic of exception and
its use.

It would also be great, if any one of you could give me certain links on
exceptions which would help me understand its concepts better.

Thank You

2007/9/10, Advait B. [email protected]:

I have a basic idea of what an exception is but I am not able to
understand it so that I can make use of it in my application’s.
If possible please try and help me out with the basic of exception and
its use.

It would also be great, if any one of you could give me certain links on
exceptions which would help me understand its concepts better.

Basically an exception signals a situation that cannot be dealt with
in the normal flow of operation (e.g. you are reading from a file and
the disk fails or the current method received invalid parameters).
Exceptions should not be abused for normal flow control (e.g. exiting
a loop).

Beyond those commonplaces it starts to get wiggly. There are many
people who have different opinions about what is an exception and what
not and I have seen heated debates about individual cases. One
general rule of thumb could be: if you find yourself returning a flag
indicating success or failure of a method then chances are that you
might rather want an exception for the failure case. As always, take
this with a grain of salt. :slight_smile:

Kind regards

robert

On Sep 10, 8:08 am, Advait B. [email protected] wrote:

Thank You

Posted viahttp://www.ruby-forum.com/.

The de facto bible of Ruby:
http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_exceptions.html

Enjoy :slight_smile:
FireAphis

Hi,

… And you’ll find many other links in this wikipedia page :

http://en.wikipedia.org/wiki/Exception_handling

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs