[Ironruby-core] Raising Exceptions

Tomas Matousek Tomas.Matousek at microsoft.com
Thu Dec 6 14:31:04 EST 2007


Yes, use RubyExceptions where possible. Otherwise just throw corresponding BCL exception. We may enrich RubyException class with more commonly thrown exceptions. When we do so, we will search and replace affected throws across the library - that's easy. So if you don't find the exception that should be thrown in this class feel free to just throw the BCL exception directly. The reasons for using RubyExceptions are clarity, code reuse and consistency in error messages. RubyExceptions class should be one of the few places where Ruby to BCL exception mapping takes place - methods on RubyExceptions should be named after Ruby exception classes, so the library writer doesn't need to think about the mapping. The class needs some refactoring though and it should probably be moved to the library. It's on my TODO list to do so.

Tomas

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of John Messerly
Sent: Thursday, December 06, 2007 11:07 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Raising Exceptions

Peter Bacon Darwin:

> And to add further confusion there are also
> RubyExceptions.CreateXXXError methods available.
>
> What to use?

I think the convention is to use the RubyExceptions.CreateXXXError methods (although I'm not clear on the reason).

- John

_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core


More information about the Ironruby-core mailing list