Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 06-15-2005
rc_hz rc_hz is offline
Registered User
 
Name: Eric RC
Organization: www.genband.com
Project: No project yet
 
Join Date: Jul 2004
Location: Hangzhou, China
Posts: 189
Send a message via MSN to rc_hz
-->
A question about Exception hierarchy in Ice

Quote:
If an operation implementation raises a run-time exception other than
ObjectNotExistException, FacetNotExistException, or
OperationNotExistException (such as a NotRegisteredException), the
client receives an UnknownLocalException. In other words, the Ice protocol
does not transmit the exact exception that was encountered in the server, but
simply returns a bit to the client in the reply to indicate that the server encountered
a run-time exception.
Suppose an operation throws an CompressionNotSupportedException on the server side, then the client will get an UnknownLocalException and know nothing about CompressionNotSupportedException.

My suggestion:
Since every exception has an unique name(eg. CompressionNotSupportedException's name is "Ice::CompressionNotSupportedException"), it's better that if we can transfer this information to the client. It needs little change to Ice:

Code:
//Exception.cpp	
class ICE_UTIL_API Exception
{
	//...
public:
	void ice_setRealName(const char* realName)
	{
		  _realName = realName;
	}  

	char * ice_getRealName()
	{
		  return _realName;
	}  	
private:    
    const char* _realName;
};
	
//Incoming.cpp
    before we replace CompressionNotSupportedException(ex_1) with UnknownLocalException(ex_2), we can do like this:
    ex_2.ice_realName(ex_1.ice_name());

//Client.cpp
//...
try
{
	thePrx->theOperation(...);
}
catch {const UnknownLocalException& ex)
{
	cout << "The exception " << ex.ice_getRealName() << " is caught" << endl;
}
//...
__________________
Eric RC
www.genband.com (telecommunication)
I like ICE (Ice for C++/Java/Python)

Last edited by rc_hz : 06-15-2005 at 04:38 AM.
Reply With Quote
  #2 (permalink)  
Old 06-15-2005
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,532
If you take a closer look at the definition of Ice::UnknownException (in Ice-2.1.1/slice/Ice/LocalException.ice), we actually transfer the stringified representation of the exception in the "unknown" field.

Benoit.
Reply With Quote
  #3 (permalink)  
Old 06-15-2005
rc_hz rc_hz is offline
Registered User
 
Name: Eric RC
Organization: www.genband.com
Project: No project yet
 
Join Date: Jul 2004
Location: Hangzhou, China
Posts: 189
Send a message via MSN to rc_hz
-->
Great , Thank you!
__________________
Eric RC
www.genband.com (telecommunication)
I like ICE (Ice for C++/Java/Python)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
General Slice Exception question jae Help Center 1 02-02-2007 09:37 PM
Exception throwing question g00fy Help Center 2 06-28-2006 08:40 PM
Question about slice and exception. OrNot Help Center 6 10-22-2005 01:07 AM
problem aboiut stream hierarchy rc_hz Comments 2 05-25-2005 05:15 AM
Bad alloc exception question stephan Bug Reports 1 12-26-2004 05:22 PM


All times are GMT -4. The time now is 04:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.