etch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vei...@apache.org
Subject svn commit: r1578902 - /etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp
Date Tue, 18 Mar 2014 13:58:18 GMT
Author: veithm
Date: Tue Mar 18 13:58:18 2014
New Revision: 1578902

URL: http://svn.apache.org/r1578902
Log:
Handling of Exception in sessionNofity call for HelloWorld example

This patch adds code to the HelloWorldClient implemenation which shows
how to handle Exceptions send by the stack to session.

Change-Id: I4191c08d7eeb2655813a4c0e89d4873d2dec41d1

Modified:
    etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp

Modified: etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp?rev=1578902&r1=1578901&r2=1578902&view=diff
==============================================================================
--- etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp (original)
+++ etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp Tue Mar 18 13:58:18
2014
@@ -20,8 +20,15 @@ using namespace org_apache_etch_examples
   }
 
   status_t ImplHelloWorldClient::_sessionNotify(capu::SmartPointer<EtchObject> event
) {
-    EtchStringPtr eventName = capu::smartpointer_cast<EtchString>(event);
-    printf("Got sessionNotifyEvent %s\n",eventName->c_str());
+    if (event->isInstanceOf(EtchString::TYPE())) {
+        EtchStringPtr eventName = capu::smartpointer_cast<EtchString>(event);
+        printf("Got sessionNotifyEvent %s\n",eventName->c_str());
+    } else if (event->isInstanceOf(EtchException::TYPE())) {
+            EtchException* eventName = (EtchException*) event.get();
+            printf("Got sessionNotify Exception %s\n",eventName->getErrorMessage().c_str());
+    } else {
+        printf("Got sessionNotify of type %d\n",event->getObjectType()->getTypeId());
+    }
     
     return ETCH_OK;
   }



Mime
View raw message