Hello everybody,

Is there any way how to catch exception thrown from constructor?

Lets say I have following class in my .i file:

class Foo
{
public:
        Foo();
        %exception {
                try {
                        $action
                }
                catch (...) {
                        static VALUE range_error = rb_define_class("CuboidPathFinderException", rb_eStandardError);
                        rb_raise(range_error, "Exception");
                }
        }

        void someMethod();
};

The exception can be caught for someMethod but unfortunatelly not for constructor. Any advice?

Thanks.


Vit