Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the right exception subclass in ruby

Tags:

exception

ruby

I have access to ruby's exception hierarchy (it's mentioned in both the pickaxe and the hummingbird), but I'm not sure which exception to use because I haven't found any information on what each of the terms mean.

Does using the right exception class matter?

like image 837
Andrew Grimm Avatar asked Mar 30 '09 22:03

Andrew Grimm


1 Answers

It matters when creating your own exceptions. One important caveat is that exceptions which inherit from Exception rather then StandardError (common mistake) will not be caught by rescue (without any arguments).

like image 65
sris Avatar answered Oct 25 '22 05:10

sris