Discussion:
[omniORB] Problems catching exceptions in clients
Silly & Chrischi
2008-04-10 23:14:02 UTC
Permalink
Hello Guys,



i have problems catching exceptions thrown by the server.

Here ist a part of my idl:



module MysqlPackage {

interface Mysql {

exception MysqlException {

string reason;

};

};

};



I throw the exception by the server and her eis my code for it:



if(mysql_errno(mysqlDatabase) != 0){

throw MysqlPackage::Mysql::MysqlException("MySQL-Error");

}



But now, if i would like to catch the exception, i get a message by the
server, that sound like this:



"omniORB: WARNING - method ,xx' on: root<1> raised the exception:
IDL:MysqlPackage/Mysql/MysqlException:1.0"



I used the following statement to catch my exception:



catch (const MysqlPackage::Mysql::MysqlException::Exception& ex){

cout << "ERROR: " << ex._name() << endl;

}



Thank you for your help. I don't know what to do.



Christian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080410/feed4540/attachment.htm
Martin Trappel
2008-04-11 12:24:04 UTC
Permalink
Post by Silly &amp; Chrischi
Hello Guys,
i have problems catching exceptions thrown by the server.
module MysqlPackage {
interface Mysql {
exception MysqlException {
string reason;
};
};
};
if(mysql_errno(mysqlDatabase) != 0){
throw MysqlPackage::Mysql::MysqlException("MySQL-Error");
}
But now, if i would like to catch the exception, i get a message by the
IDL:MysqlPackage/Mysql/MysqlException:1.0?
What is the signature of the IDL interface method you throw the
exception from? Does it declare that it will throw the exception?

module MySQLPackage {
exception MySQLException { string reason; };
interface MySQL {
void open() raises(MySQLException);
void close() raises(MySQLException);
void fetch() raises(MySQLException);
};
};

br,
Martin
evgeni.rojkov at durr.com ()
2008-04-11 13:55:38 UTC
Permalink
... could yout try "throw new MysqlPackage::Mysql::MysqlException(...);"
... just try to add this "new".
Kind Regards, Evgeni

-----Urspr?ngliche Nachricht-----
Von: omniorb-list-***@omniorb-support.com
[mailto:omniorb-list-***@omniorb-support.com] Im Auftrag von Silly &
Chrischi
Gesendet: Donnerstag, 10. April 2008 19:14
An: omniorb-***@omniorb-support.com
Betreff: [omniORB] Problems catching exceptions in clients



Hello Guys,



i have problems catching exceptions thrown by the server.

Here ist a part of my idl:



module MysqlPackage {

interface Mysql {

exception MysqlException {

string reason;

};

};

};



I throw the exception by the server and her eis my code for it:



if(mysql_errno(mysqlDatabase) != 0){

throw MysqlPackage::Mysql::MysqlException("MySQL-Error");

}



But now, if i would like to catch the exception, i get a message by the
server, that sound like this:



"omniORB: WARNING - method 'xx' on: root<1> raised the exception:
IDL:MysqlPackage/Mysql/MysqlException:1.0"



I used the following statement to catch my exception:



catch (const MysqlPackage::Mysql::MysqlException::Exception& ex){

cout << "ERROR: " << ex._name() << endl;

}



Thank you for your help. I don't know what to do.



Christian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080411/087c8b35/attachment.htm
Clarke Brunt
2008-04-11 17:02:36 UTC
Permalink
Post by evgeni.rojkov at durr.com ()
... could yout try "throw new
MysqlPackage::Mysql::MysqlException(...);" ... just try to add this
"new".
At the risk of my talking nonsense, I don't think that's correct.

If you add "new", then you are throwing a pointer to the exception. For
one thing, you could then have to catch a pointer as well (rather than
catching by value or by reference), but I don't believe that the CORBA
C++ mapping tells you to throw pointers - you are just supposed to throw
the object. So if you _did_ throw a pointer, then omniORB wouldn't
recognise it, and you'd just end up with a generic exception at the
client.

Clarke Brunt
TRAFFICMASTER PLC
UNIT 22 / ST. JOHN'S INNOVATION CENTRE
COWLEY ROAD / CAMBRIDGE / CB4 0WS
T: 01223 422469
F:
E: ***@trafficmaster.co.uk


Please consider the environment before printing this email. --------------------------------------------------------

Trafficmaster PLC is a limited Company registered in England and Wales.
Registered number: 2292714 Registered office: Martell House, University Way, Cranfield, BEDS. MK43 0TR

This message (and any associated files) is intended only for the use of omniorb-***@omniorb-support.com and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not omniorb-***@omniorb-support.com you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author ***@trafficmaster.co.uk and do not necessarily represent those of the company.

Warning: Although the company has taken reasonable precautions to ensure no viruses are present in this email, the company cannot accept responsibility for any loss or damage arising from the use of this email or attachments.
--------------------------------------------------------
Ridgway, Richard (London)
2008-04-11 17:20:15 UTC
Permalink
Post by Silly &amp; Chrischi
catch (const MysqlPackage::Mysql::MysqlException::Exception& ex){
cout << "ERROR: " << ex._name() << endl;
}
Shouldn't that just be catch (const MysqlPackage::Mysql::MysqlException
& ex)

Is your client calling an idl method that is declared to throw this
exception?


Richard


-----Original Message-----
From: omniorb-list-***@omniorb-support.com
[mailto:omniorb-list-***@omniorb-support.com] On Behalf Of Clarke
Brunt
Sent: 11 April 2008 12:02
To: omniorb-***@omniorb-support.com
Subject: RE: [omniORB] Problems catching exceptions in clients
Post by Silly &amp; Chrischi
... could yout try "throw new
MysqlPackage::Mysql::MysqlException(...);" ... just try to add this
"new".
At the risk of my talking nonsense, I don't think that's correct.

If you add "new", then you are throwing a pointer to the exception. For
one thing, you could then have to catch a pointer as well (rather than
catching by value or by reference), but I don't believe that the CORBA
C++ mapping tells you to throw pointers - you are just supposed to throw
the object. So if you _did_ throw a pointer, then omniORB wouldn't
recognise it, and you'd just end up with a generic exception at the
client.

Clarke Brunt
TRAFFICMASTER PLC
UNIT 22 / ST. JOHN'S INNOVATION CENTRE
COWLEY ROAD / CAMBRIDGE / CB4 0WS
T: 01223 422469
F:
E: ***@trafficmaster.co.uk


Please consider the environment before printing this email.
--------------------------------------------------------

Trafficmaster PLC is a limited Company registered in England and Wales.
Registered number: 2292714 Registered office: Martell House,
University Way, Cranfield, BEDS. MK43 0TR

This message (and any associated files) is intended only for the use of
omniorb-***@omniorb-support.com and may contain information that is
confidential, subject to copyright or constitutes a trade secret. If you
are not omniorb-***@omniorb-support.com you are hereby notified that
any dissemination, copying or distribution of this message, or files
associated with this message, is strictly prohibited. If you have
received this message in error, please notify us immediately by replying
to the message and deleting it from your computer. Any views or opinions
presented are solely those of the author
***@trafficmaster.co.uk and do not necessarily represent those
of the company.

Warning: Although the company has taken reasonable precautions to ensure
no viruses are present in this email, the company cannot accept
responsibility for any loss or damage arising from the use of this email
or attachments.
--------------------------------------------------------

_______________________________________________
omniORB-list mailing list
omniORB-***@omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list
--------------------------------------------------------

This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing.
--------------------------------------------------------

Continue reading on narkive:
Loading...