[omniORB] Regarding UserException catching Scenario.

Ratheesh .R ratheeshr_2006 at yahoo.com
Wed Jul 27 01:13:13 BST 2011


Hello
OmniORB experts,



 First
of all thanks for your wonderful OmniORB product and supports that
you are providing.



Let me ask you one question regarding UserException, as a part of our
upcoming project we are evaluating omniORB and  we are struggling to
evaluate the UserException scenario.



please
see the below details and suggest me your solution ,



1)
In IDL we have provided the User exceptions with in the raises
 function as like below,
    

 void
terminate() raises ( ExecutableDevice::InvalidProcess )



with
 InvalidProcess  having members of,



short
ErrorNumber;
string
ErrorMsg;



2)At
the server side we have implemented ExecutableDeviceImpl
and InvalidProcessImpl objects
and
with in the ExecutableDeviceImpl object
we have created the function terminate ()  and throwing the 
UserException as like below ,



void
terminate() throw ( ExecutableDevice::InvalidProcess )
{
    throw
( InvalidProcessImpl( 2, "Error in Terminating the process "));
}



Note
:- this InvalidProcessImpl is inherited from InvalidProcess and
std::runtime_error exception.



3)
At the client side  when we are calling the terminate process
then getting the UserException correctly ,but we are not able to see
the error message that raised at server side ie,  ErrorNumber
and ErrorMsg. Please see the code I have written client side.



//after
ORB initialization and NameResolving of ExecutableDevice we are
calling the terminate  function,
try
{
   ExecutableDevice_mgr->terminate();
}
 

catch(
CORBA::UserException& ex)
{
   cerr<<"\n
CORBA  user Exception ";
   cerr<<ex._rep_id();
   cerr<<ex._name();



//CF::ExecutableDevice::InvalidProcess*
//inval=CF::ExecutableDevice::InvalidProcess::_downcast(&ex);
//cerr<<"\n
THE DATA="<<inval->ErrorMsg;



//CF::ExecutableDevice::InvalidProcess
//exeDev=CF::ExecutableDevice::InvalidProcess::_narrow(ex);

//cerr<<exeDev.ErrorMsg;



}



i
am getting the output at client side like below,which is correct but
not able to print the  ErrorMsg and ErrorNumber of InvalidProcess .



Output
at client :-  CORBA UserException:-
IDL:CF/ExecutableDevice/InvalidProcess:1.0InvalidProcess



i
have tried with down cast and narrow methods to print the
InvalidProcess Exception details, which you can see in my code above 
but was not successful,



do
u find any mistake in my approach ?? or do i have to do any
additional methods to get the UserException data at client side.?



awaiting
for your valuable information,



thanks
Ratheesh



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20110727/6ee53430/attachment.htm


More information about the omniORB-list mailing list