[omniORB] omniORBpy Exception Question (and omniidlexception patch).

Randy Wiser randyw@amc.com
Tue, 28 Mar 2000 14:10:09 -0800


Hi Richard,

I think I agree with you that CORBA.Exception should inherit from exceptions.Exception (as it does now).  
I'm also suggesting (requesting?) that if:

1) Exceptions defined in stubs generated by omniidl inherit from CORBA.Exceptions (and so exceptions.Exception).

and

2) Exceptions defined in the stubs override the __init__ method.

then:

3) The __init__ method should also call back to the original __init__ method that was overridden, as you explain.

Though it appears harmless (except in my own strange situation) to omit calling exceptions.Exception.__init__() in Python 1.5.2, perhaps a future version of Python may have a more critical use for this method?

Thanks,

- Randy

At 11:36 PM 03/28/2000 +0200, Richard Gruet wrote:
>Randy,
>
>It's not illogical that  CORBA exceptions inherit from class exceptions.Exception in the Python mapping, since this is the recommended thing to do in all the manuals (except for the deprecated old string exceptions).
>But oddly enough, in Python you may also raise (and catch with an except) an instance from a class not derived from Exception! I must confess that I don't clearly see the rationale behind this (ask Guido?).
>In my opinion, CORBA.Exception should therefore inherit from exceptions.Exception, but ONTH, your arguments look correct too, and the new point is: is it mandatory that an exception derived from exceptions.Exception call Exception.__init__ ? I often omit that, and so far that was harmless. Anyway,
>calling Exception.__init__ should be reserved to the derived (CORBA) exception's __init__ method, not to the final user of the exception. And furthermore it should be done as the first action performed, before any direct initialization; this way, no data members can be overwritten in the derived class
>(but it can occur in exceptions.Exception!)
>
>I think that I'm gonna take some aspirin now ;-)
>Cheers,
>
>Richard Gruet