List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:March 21 2007 6:42pm
Subject:Re: SWIG_exception vs. SWIG_exception_fail
View as plain text  
Bother. I think there might be some inconsistency within SWIG. I believe
we started off using SWIG_exception_fail and that it didn't work right
under Java or something. I'll look deeper and see if I can remember what
the issue was.

Monty

Mika Raento wrote:
> Hello
> 
> I think we need to use SWIG_exception_fail instead of SWIG_exception.
> 
> In python they are actually defined as the same thing, but in perl
> SWIG_exception_fail does a 'goto fail;' and the croak() is done under
> fail. A plain SWIG_exception continues in the success path and doesn't
> throw an exception (it just creates the exception information but
> doesn't throw it).
> 
> With SWIG_exception,
> $connection = new ndb::Ndb_cluster_connection();
> if ($connection->connect(5,3,1)) {
> 
>     print "Connect to cluster management server failed.\n";
>     exit -1;
> }
> 
> actually prints
> Connect to cluster management server failed.
> 
> Whereas with SWIG_exception_fail, the script dies with
> RuntimeError Connect to management server failed
> 
> Which is the behaviour I assume we are looking for.
> 
> I'll provide a patch in a bit.
> 
>    Mika
> 


-- 
Monty Taylor
Senior Consultant
MySQL Inc., www.mysql.com
Get More with MySQL!  www.mysql.com/consulting
Thread
SWIG_exception vs. SWIG_exception_failMika Raento21 Mar
  • Re: SWIG_exception vs. SWIG_exception_failMonty Taylor21 Mar
    • Re: SWIG_exception vs. SWIG_exception_failMonty Taylor22 Mar
      • exceptions and perlMika Raento22 Mar
        • Re: exceptions and perlMonty Taylor22 Mar