[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Raising Excepitons

John W. Long

11/13/2003 3:45:00 AM

Hi,

I'm curious. In code I often raise my own exceptions with:

raise "custom error message"

When is it a good idea to subclass and create my own error class? So far
I've never needed to pass along custom information (other than the message).
It seems like it might make testing better:

assert_raises(MyError) { ... }

instead of:

assert_raises(RuntimeError) { ... }

Are there any other advantages? Are there times when it's convention to
create your own?

___________________
John Long
www.wiseheartdesign.com