Ejemplo n.º 1
0
    void
    exception(const Ice::Exception& ex)
    {
        try
        {
            ex.ice_throw();
        }
        catch(const DeploymentException& ex)
        {
            if(_traceLevels && _traceLevels->server > 1)
            {
                Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
                out << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex.reason;
            }

            ostringstream os;
            os << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex.reason;
            _server->exception(DeploymentException(os.str()));
        }
        catch(const Ice::Exception& ex)
        {
            if(_traceLevels && _traceLevels->server > 1)
            {
                Ice::Trace out(_traceLevels->logger, _traceLevels->serverCat);
                out << "couldn't unload `" << _id << "' on node `" << _node << "':\n" << ex;
            }
            ostringstream os;
            os << ex;
            _server->exception(NodeUnreachableException(_node, os.str()));
        }
    }
Ejemplo n.º 2
0
string
IceGrid::toString(const Ice::Exception& exception)
{
    std::ostringstream os;
    try
    {
        exception.ice_throw();
    }
    catch(const NodeUnreachableException& ex)
    {
        os << ex << ":";
        os << "\nnode: " << ex.name;
        os << "\nreason: " << ex.reason;
    }
    catch(const DeploymentException& ex)
    {
        os << ex << ":";
        os << "\nreason: " << ex.reason;
    }
    catch(const Ice::Exception& ex)
    {
        os << ex;
    }
    return os.str();
}
Ejemplo n.º 3
0
void
LambdaInvoke::handleInvokeException(const Ice::Exception& ex, OutgoingAsyncBase*) const
{
    try
    {
        ex.ice_throw();
    }
    catch(const Ice::Exception&)
    {
        _exception(current_exception());
    }
}
Ejemplo n.º 4
0
void
Parser::exception(const Ice::Exception& ex, bool warn)
{
    ostringstream os;
    try
    {
        ex.ice_throw();
    }
    catch(const LinkExists& ex)
    {
        os << "link `" << ex.name << "' already exists";
    }
    catch(const NoSuchLink& ex)
    {
        os << "couldn't find link `" << ex.name << "'";
    }
    catch(const TopicExists& ex)
    {
        os << "topic `" << ex.name << "' exists";
    }
    catch(const NoSuchTopic& ex)
    {
        os << "couldn't find topic `" << ex.name << "'";
    }
    catch(const UnknownManagerException& ex)
    {
        os << "couldn't find IceStorm service `" << ex.name << "'";
    }
    catch(const IdentityParseException& ex)
    {
        os << "invalid identity `" << ex.str << "'";
    }
    catch(const Ice::LocalException& ex)
    {
        os << "couldn't reach IceStorm service:\n" << ex;
    }
    catch(const Ice::Exception& ex)
    {
        os << ex;
    }

    if(warn)
    {
        warning(os.str());
    }
    else
    {
        error(os.str());
    }
}
Ejemplo n.º 5
0
 virtual void exception_UndeclaredC(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Ice::UnknownUserException&)
     {
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 6
0
 virtual void exception_NonIceException(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Ice::UnknownException&)
     {
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 7
0
void
CreateSession::createException(const Ice::Exception& ex)
{
    try
    {
        ex.ice_throw();
    }
    catch(const CannotCreateSessionException& ex)
    {
        exception(ex);
    }
    catch(const Ice::Exception& ex)
    {
        unexpectedCreateSessionException(ex);
    }
}
Ejemplo n.º 8
0
 virtual void exception_AasAFacetNotExist(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Ice::FacetNotExistException& ex)
     {
         test(ex.facet == "no such facet");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 9
0
 virtual void exception_noSuchOperation(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Ice::OperationNotExistException& ex)
     {
         test(ex.operation == "noSuchOperation");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 10
0
 virtual void exception_AasAObjectNotExist(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Ice::ObjectNotExistException& ex)
     {
         Ice::Identity id = _communicator->stringToIdentity("does not exist");
         test(ex.id == id);
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 11
0
 virtual void exception_BasA(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const B& ex)
     {
         test(ex.aMem == 1);
         test(ex.bMem == 2);
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 12
0
 virtual void exception_LocalException(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Ice::UnknownLocalException&)
     {
     }
     catch(const Ice::OperationNotExistException&)
     {
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 13
0
 void
 exception_unknownDerivedAsBase(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Base& b)
     {
         test(b.b == "UnknownDerived.b");
         test(b.ice_id() == "::Test::Base");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 14
0
 void
 exception_baseAsBase(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Base& b)
     {
         test(b.b == "Base.b");
         test(b.ice_id() =="::Test::Base");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 15
0
 void
 exception_unknownMostDerived1AsKnownIntermediate(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownIntermediate& ki)
     {
         test(ki.b == "UnknownMostDerived1.b");
         test(ki.ki == "UnknownMostDerived1.ki");
         test(ki.ice_id() == "::Test::KnownIntermediate");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 16
0
 void exceptAbortI(const Ice::Exception& ex)
 {
     try
     {
         ex.ice_throw();
     }
     catch(const Ice::ConnectionLostException&)
     {
     }
     catch(const Ice::ConnectFailedException&)
     {
     }
     catch(const Ice::Exception& ex)
     {
         cout << ex << endl;
         test(false);
     }
     called();
 }
Ejemplo n.º 17
0
 void
 exception_knownDerivedAsKnownDerived(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownDerived& k)
     {
         test(k.b == "KnownDerived.b");
         test(k.kd == "KnownDerived.kd");
         test(k.ice_id() == "::Test::KnownDerived");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 18
0
 void
 exception_knownIntermediateAsBase(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownIntermediate& ki)
     {
         test(ki.b == "KnownIntermediate.b");
         test(ki.ki == "KnownIntermediate.ki");
         test(ki.ice_id() == "::Test::KnownIntermediate");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 19
0
void
ProxyOutgoingAsyncBase::abort(const Ice::Exception& ex)
{
    assert(!_childObserver);

    if(finished(ex))
    {
        invokeCompletedAsync();
    }
    else if(dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex))
    {
        //
        // If it's a communicator destroyed exception, don't swallow
        // it but instead notify the user thread. Even if no callback
        // was provided.
        //
        ex.ice_throw();
    }
}
Ejemplo n.º 20
0
 virtual void exception_AorDasAorD(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const A& ex)
     {
         test(ex.aMem == 1);
     }
     catch(const D& ex)
     {
         test(ex.dMem == -1);
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 21
0
 void
 exception_knownMostDerivedAsKnownIntermediate(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownMostDerived& kmd)
     {
         test(kmd.b == "KnownMostDerived.b");
         test(kmd.ki == "KnownMostDerived.ki");
         test(kmd.kmd == "KnownMostDerived.kmd");
         test(kmd.ice_id() == "::Test::KnownMostDerived");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 22
0
Archivo: AdminI.cpp Proyecto: zmyer/ice
 void
 handleException(const Ice::Exception& ex) const
 {
     try
     {
         ex.ice_throw();
     }
     catch(const Ice::UserException&)
     {
         throw;
     }
     catch(const Ice::ObjectNotExistException&)
     {
         throw ServerNotExistException(_id);
     }
     catch(const Ice::LocalException& e)
     {
         ostringstream os;
         os << e;
         throw NodeUnreachableException(_node, os.str());
     }
 }
Ejemplo n.º 23
0
 virtual void exception_ModA(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Mod::A& ex)
     {
         test(ex.aMem == 1);
         test(ex.a2Mem == 2);
     }
     catch(const Ice::OperationNotExistException&)
     {
         //
         // This operation is not supported in Java.
         //
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Ejemplo n.º 24
0
void 
IceInternal::LocatorInfo::getEndpointsException(const ReferencePtr& ref, const Ice::Exception& exc)
{
    assert(ref->isIndirect());

    try
    {
        exc.ice_throw();
    }
    catch(const AdapterNotFoundException&)
    {
        if(ref->getInstance()->traceLevels()->location >= 1)
        {
            Trace out(ref->getInstance()->initializationData().logger,
                      ref->getInstance()->traceLevels()->locationCat);
            out << "adapter not found" << "\n";
            out << "adapter = " << ref->getAdapterId();
        }

        NotRegisteredException ex(__FILE__, __LINE__);
        ex.kindOfObject = "object adapter";
        ex.id = ref->getAdapterId();
        throw ex;
    }
    catch(const ObjectNotFoundException&)
    {
        if(ref->getInstance()->traceLevels()->location >= 1)
        {
            Trace out(ref->getInstance()->initializationData().logger,
                      ref->getInstance()->traceLevels()->locationCat);
            out << "object not found" << "\n";
            out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
        }

        NotRegisteredException ex(__FILE__, __LINE__);
        ex.kindOfObject = "object";
        ex.id = ref->getInstance()->identityToString(ref->getIdentity());
        throw ex;
    }
    catch(const NotRegisteredException&)
    {
        throw;
    }
    catch(const LocalException& ex)
    {
        if(ref->getInstance()->traceLevels()->location >= 1)
        {
            Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
            out << "couldn't contact the locator to retrieve adapter endpoints\n";
            if(ref->getAdapterId().empty())
            {
                out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
            }
            else
            {
                out << "adapter = " << ref->getAdapterId() << "\n";
            }
            out << "reason = " << ex;
        }
        throw;
    }
}
Ejemplo n.º 25
0
void
ProxyFlushBatch::handleRetryException(const Ice::Exception& ex)
{
    _proxy->__setRequestHandler(_handler, 0); // Clear request handler
    ex.ice_throw(); // No retries, we want to notify the user of potentially lost batch requests
}
Ejemplo n.º 26
0
void
IcePHP::convertException(zval* zex, const Ice::Exception& ex)
{
    ZVAL_UNDEF(zex);

    ostringstream ostr;
    ostr << ex;
    string str = ostr.str();

    try
    {
        ex.ice_throw();
    }
    catch(const Ice::LocalException& e)
    {
        zend_class_entry* cls = idToClass(e.ice_id());
        if(cls)
        {
            if(object_init_ex(zex, cls) != SUCCESS)
            {
                runtimeError("unable to create exception %s", cls->name->val);
                return;
            }
            if(!convertLocalException(e, zex))
            {
                return;
            }
        }
        else
        {
            cls = idToClass("Ice::UnknownLocalException");
            assert(cls);
            if(object_init_ex(zex, cls) != SUCCESS)
            {
                runtimeError("unable to create exception %s", cls->name->val);
                return;
            }
            setStringMember(zex, "unknown", str);
        }
    }
    catch(const Ice::UserException&)
    {
        zend_class_entry* cls = idToClass("Ice::UnknownUserException");
        assert(cls);
        if(object_init_ex(zex, cls) != SUCCESS)
        {
            runtimeError("unable to create exception %s", cls->name->val);
            return;
        }
        setStringMember(zex, "unknown", str);
    }
    catch(const Ice::Exception&)
    {
        zend_class_entry* cls = idToClass("Ice::UnknownException");
        assert(cls);
        if(object_init_ex(zex, cls) != SUCCESS)
        {
            runtimeError("unable to create exception %s", cls->name->val);
            return;
        }
        setStringMember(zex, "unknown", str);
    }

    return;
}
Ejemplo n.º 27
0
void
IceInternal::IncomingBase::__handleException(const Ice::Exception& ex)
{
    try
    {
        ex.ice_throw();
    }
    catch(RequestFailedException& ex)
    {
        if(ex.id.name.empty())
        {
            ex.id = _current.id;
        }
        
        if(ex.facet.empty() && !_current.facet.empty())
        {
            ex.facet = _current.facet;
        }
        
        if(ex.operation.empty() && !_current.operation.empty())
        {
            ex.operation = _current.operation;
        }

        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            if(dynamic_cast<ObjectNotExistException*>(&ex))
            {
                _os.write(static_cast<Byte>(DispatchObjectNotExist));
            }
            else if(dynamic_cast<FacetNotExistException*>(&ex))
            {
                _os.write(static_cast<Byte>(DispatchFacetNotExist));
            }
            else if(dynamic_cast<OperationNotExistException*>(&ex))
            {
                _os.write(static_cast<Byte>(DispatchOperationNotExist));
            }
            else
            {
                assert(false);
            }

            ex.id.__write(&_os);

            //
            // For compatibility with the old FacetPath.
            //
            if(ex.facet.empty())
            {
                _os.write(static_cast<string*>(0), static_cast<string*>(0));
            }
            else
            {
                _os.write(&ex.facet, &ex.facet + 1);
            }

            _os.write(ex.operation, false);
            
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UnknownLocalException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownLocalException));
            _os.write(ex.unknown, false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UnknownUserException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownUserException));
            _os.write(ex.unknown, false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UnknownException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownException));
            _os.write(ex.unknown, false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const LocalException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownLocalException));
            ostringstream str;
            str << ex;
            _os.write(str.str(), false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UserException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownUserException));
            ostringstream str;
            str << ex;
            _os.write(str.str(), false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const Exception& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownException));
            ostringstream str;
            str << ex;
            _os.write(str.str(), false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
}