views:

53

answers:

2

I have noticed that in the Ruby exception hierarchy, there are "errors" such as ArgumentError and there are "exceptions" such as SignalException. Is there a certain practise of naming exceptions? thanks in advance, ell.

+1  A: 

Looking at the list of Ruby exceptions, SignalException is the only one that is named *Exception; everything else is an XXXError (except for SystemExit and fatal). If anything, the practice is to name your exception FooError. I'm having trouble finding any specific reason why SignalException isn't named SignalError.

Mark Rushakoff
+2  A: 

The convention is Module::#{Type}Error for anything caused by your application (e.g. http://weblog.jamisbuck.org/2007/3/7/raising-the-right-exception). Exception handling in Ruby isn't stratified the same way as in Java since the exception model is different at the language level.

From what I've seen, the conventions are adhered to a little more loosely for C/FFI/JNA extensions.

Denny Abraham