Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 01-14-2007
Greenhippo Greenhippo is offline
Registered User
 
Name: Alex
Organization: University of Auckland
Project: Intelligent Middleware
 
Join Date: Nov 2006
Posts: 32
Runtime Exception

Hi,

I know ice has a bunch of predefined runtime exceptions, but I cant seem to find a way to make user defined runtime exception. Is there anyway to do this or will i just have to settle with making UnknownLocalExceptions
__________________
Alex Davies
The University of Auckland
Reply With Quote
  #2 (permalink)  
Old 01-14-2007
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,781
Ice has local and non-local exceptions. Local exceptions are also referred to as runtime exceptions, since they are used by the Ice runtime to indicate local failures, such as when the runtime runs out of sockets, memory, if there is a timeout, etc.

Except for RequestFailedException and its derivates (ObjectNotExistException, OperationNotExistException, and FacetNotExistException), these exceptions have only meaning in the local process. As such, they are not transferred to a client. If they are raised, then a client will get an UnknownLocalException.

Your own code should neither raise (except for RequestFailedException and derived exceptions) nor define these exceptions. If you want to define local exception that are not transmitted, do so directly in your concrete programming language. If you want exceptions that are transmitted to the client, then define regular exceptions.
Reply With Quote
  #3 (permalink)  
Old 01-14-2007
Greenhippo Greenhippo is offline
Registered User
 
Name: Alex
Organization: University of Auckland
Project: Intelligent Middleware
 
Join Date: Nov 2006
Posts: 32
Thank you for such a quick reply

The purpose of wanting a user defined runtime exception was to allow the server to throw something in order to tell the client to clear its locator cache and do another registry lookup. And as this can occur with any method call it would be inconvenaint to have to explicitly state that for every method

However ive come across a way for the server to clear the clients cache and im not entirely sure why it works, or even if it should work. By getting my server to run
Code:
__current.con.close(false);
throw new Ice.ObjectNotExistException(__current.id, __current.facet, __current.operation);
the client not only automatically trys to reconnect but it also clears its locator cache. Is this behaviour something that would be caused by another piece of my code i missed, a rather convenient bug or intended behavoiur?
__________________
Alex Davies
The University of Auckland
Reply With Quote
  #4 (permalink)  
Old 01-15-2007
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,543
Hi,

Why do you need the server to notify the client to clear its locator cache?

The Ice runtime clears from the locator cache the endpoints of an indirect proxy for a well-known object if it receives an Ice::ObjectNotExistException. I suspect that's the reason why it works with the code you mention (you shouldn't need to close the connection though).

Cheers,
Benoit.
Reply With Quote
  #5 (permalink)  
Old 04-24-2007
joshmoore joshmoore is offline
Registered User
 
Name: Josh Moore
Organization: Glencoe Software, Inc.
Project: OMERO, http://trac.openmicroscopy.org.uk/omero
 
Join Date: Feb 2007
Location: Germany
Posts: 59
Quote:
Originally Posted by marc View Post
Your own code should neither raise (except for RequestFailedException and derived exceptions) nor define these exceptions. If you want to define local exception that are not transmitted, do so directly in your concrete programming language.
When trying to provide a unified API in multiple languages, would it perhaps make sense to use local exceptions. Specifically, we're mapping our domain model into Ice. Some relationships require client-side methods to maintain consistency. E.g.
Code:
module omero {
  module model {
    sequence<omero::model::Image> ImageSeq;
    class Pixels
    {
     ImageSeq images;
     void addImage(omero::model::Image img);
    }
  }
}
which also ensures that the other side of the relationship is properly set. With a local exception of the form:
Code:
module omero {
    local exception ClientError
    {
      string message;
    };
}
I could add the exception to that addImage:
Code:
void addImage(omero::model::Image img) throws ClientError;
so it's clear in all bindings what's intended.
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
strategies for sharing ice runtime in data layer under .net programmerdad Help Center 6 08-03-2006 12:01 PM
Change IP address during runtime wgwolf Help Center 1 05-31-2006 05:35 AM
Debug runtime errors Deqing Help Center 4 02-14-2006 07:19 PM
determine messagesize during runtime DeepDiver Help Center 3 01-26-2006 08:22 AM
a runtime error fw_csha Help Center 10 09-29-2004 11:29 AM


All times are GMT -4. The time now is 12:34 PM.


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.