certi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More informations about RTI::Exceptions


From: Eric Noulard
Subject: More informations about RTI::Exceptions
Date: Tue, 16 Oct 2007 11:39:18 +0200

Hi All,

While working on the "Qualified Named" bug
https://savannah.nongnu.org/bugs/?20935

I added recently more traceability for RTI Exception.
First of all you may trigger a message for EVERY RTI::Exception
created by setting RTI_EXCEPTION env var to "X"

setenv RTI_EXCEPTION "X"   (c-shell syntax)
or
export RTI_EXCEPTION="X"   (bourne shell syntax)

You will get messages like:
HLALOG - 1192527281.448412 -  -
/LOCAL/ERIC/workspace/CERTI/libCERTI/Exception.cc> RTI::Exception
[FederationExecutionDoesNotExist,0x0] - reason=Test
HLALOG - 1192527281.449339 -  -
/LOCAL/ERIC/workspace/CERTI/libCERTI/Exception.cc> RTI::Exception
[FederateNotExecutionMember,0x0] - reason=Federate <1> not [yet]
member of Federation <Test>.

Don't be afraid by the amount of Exception launched
(even) in the "normal" operation case.

Some of them are "normal" some other are not and
I'm working on it.

While setting this up I discover that many RTI exception do not embbed
a valuable "cause".

I invite the code/patch contributor to create RTI::Exception with valuable
information, i.e.
throw EXCEPTION_NAME("a valuable message explaining  the cause")

like in the code snippet below.
As  you will read you may build the message using std::stringstream.


Object *
ObjectClass::getInstanceWithID(ObjectHandle the_id) const
    throw (ObjectNotKnown)
{
        std::stringstream msg;
        
    list<Object *>::const_iterator o ;
    for (o = objectSet.begin(); o != objectSet.end(); o++) {
        if ((*o)->getHandle() == the_id)
            return (*o);
    }

    msg << "Could not find ObjectHandle <" << the_id << "> among <"
               << objectSet.size() << "> objects of ObjectClass "
               << handle;       
        
    throw ObjectNotKnown(msg.str().c_str());
}



-- 
Erk




reply via email to

[Prev in Thread] Current Thread [Next in Thread]