Exceptions in ruby

Could any one tell me the related exception in ruby. I am in process of
porting java methods. As java uses lots of inbuilt exception its very
difficult for me to port. could any one help me to tell the related
things in ruby

      ArrayIndexOutOfBoundsException
      RuntimeException
      XmlPullParserException
      IllegalArgumentException
      UnsupportedEncodingException
      IndexOutOfBoundsException
      IOException
      EOFException
      NullPointerException
      ClassNotFoundException
      ConcurrentModificationException (Iterators throw them)

Thanks in advance

On Nov 22, 2007 11:30 AM, Martin D. [email protected] wrote:

Could any one tell me the related exception in ruby. I am in process of
porting java methods. As java uses lots of inbuilt exception its very
difficult for me to port. could any one help me to tell the related
things in ruby

Unfortunately a matching will not be possible, I am not sure if the
following list does you any good
but in some situations similar exceptions might be raised in Ruby, it
of course depends a lot
of how you translate, I still maintain my statement from the other
tread, Java cannot be translated to Ruby as
such, you need to rethink the code, maybe the following examples show
better what I meant:

      ArrayIndexOutOfBoundsException
              IndexError, but this cannot be ported easily, it is

only raised in specific situations
e.g. x=[]; x[12] → nil

      RuntimeException
              same name
      XmlPullParserException
              depends on your XML Toolkit, unlikely to find a 

correspondance

      IllegalArgumentException
              ParameterError
      UnsupportedEncodingException
              RobertHasNoClueException_SORRY ;)
      IndexOutOfBoundsException
              IndexError
      IOException
              IOError
      EOFException
             EOFError
      NullPointerException
             NoMethodError in some cases, there is no such thing

in reality, I assume that the receiver is
nil but you believe it is something else

      ClassNotFoundException
              depends on the context, NameError in some cases
      ConcurrentModificationException (Iterators throw them)
              I believe there is none

Thanks in advance

Posted via http://www.ruby-forum.com/.

Robert

On Nov 22, 2007, at 6:29 AM, Robert D. wrote:

      IllegalArgumentException
              ParameterError

Are you sure you didn’t mean to write “ArgumentError”?

Regards, Morton

On Nov 22, 2007 3:40 PM, Morton G. [email protected]
wrote:

On Nov 22, 2007, at 6:29 AM, Robert D. wrote:

      IllegalArgumentException
              ParameterError

Are you sure you didn’t mean to write “ArgumentError”?
I meant to write ParameterError, of course, boldly :wink:

502/6 > irb
irb(main):001:0> ArgumentError
=> ArgumentError
irb(main):002:0> ParameterError
NameError: uninitialized constant ParameterError
from (irb):2
irb(main):003:0>

and wrongly :frowning: