Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 02-28-2003
marlowa marlowa is offline
Registered User
 
 
Join Date: Feb 2003
Location: London
Posts: 64
Exceptions and the ice_throw function

Why do Ice exceptions have an ice_throw method? And why is it sometimes used and sometimes not? I found that on Solaris using the Forte compiler the file UserExceptionFactorymanager.cpp fails to compile because the exception NotRegisteredException is thrown using the throw statement. Changing this to ex.ice_throw() makes it compile. Can someone please explain this to me? I think it is to do with the lack of a copy ctor on the exception class and the fact that ice_throw() is a const method. Have I found a bug in UserExceptionFactorymanager.cpp?

Regards,

Andrew
__________________
You are in a maze of twisty little passages, all different.
Reply With Quote
  #2 (permalink)  
Old 02-28-2003
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,772
We have ice_throw() in order to be able to store exceptions, and throw them later.

For example, sometimes you want to have a thread that sends requests in the background (a "call queue"). Any exceptions from sending such requests are stored and thrown when the main thread tries to add another request to the call queue.

The code you are referring to is this:

NotRegisteredException ex(__FILE__, __LINE__);
ex.kindOfObject = "user exception factory";
ex.id = id;
throw ex;

I don't see anything wrong with this code. An explicit copy constructor for NotRegisteredException is not necessary, because the constructor that the C++ compiler must create by default is perfectly ok for this.
Reply With Quote
  #3 (permalink)  
Old 02-28-2003
marlowa marlowa is offline
Registered User
 
 
Join Date: Feb 2003
Location: London
Posts: 64
Quote:
Originally posted by marc
NotRegisteredException ex(__FILE__, __LINE__);
ex.kindOfObject = "user exception factory";
ex.id = id;
throw ex;

I don't see anything wrong with this code. An explicit copy constructor for NotRegisteredException is not necessary, because the constructor that the C++ compiler must create by default is perfectly ok for this.
In that case it looks like Forte requires an explicit copy ctor. Perhaps it shouldn't but it does.

-apm
__________________
You are in a maze of twisty little passages, all different.
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
C# exceptions wrobbie Help Center 7 09-25-2005 07:03 PM
Catching Exceptions chuatecksiong Help Center 3 04-06-2005 01:02 PM
Exceptions cannot be unmarshalled on client robert Bug Reports 4 10-17-2004 11:46 PM
Classes vs. Exceptions andreynech Comments 7 02-28-2003 10:12 AM


All times are GMT -4. The time now is 11:02 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.