throw CccnxOperationException
diff --git a/model/sync-ccnx-wrapper.cc b/model/sync-ccnx-wrapper.cc
index d995e81..0684cea 100644
--- a/model/sync-ccnx-wrapper.cc
+++ b/model/sync-ccnx-wrapper.cc
@@ -22,6 +22,8 @@
 
 #include "sync-ccnx-wrapper.h"
 #include <poll.h>
+#include <boost/throw_exception.hpp>
+typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info_str; 
 
 using namespace std;
 using namespace boost;
@@ -35,7 +37,9 @@
   , m_running (true)
 {
   m_handle = ccn_create();
-  ccn_connect(m_handle, NULL);
+  if (ccn_connect(m_handle, NULL) < 0) 
+		BOOST_THROW_EXCEPTION (CcnxOperationException() 
+													<< errmsg_info_str("connection to ccnd failed"));
   initKeyStore();
   createKeyLocator();
   m_thread = thread (&CcnxWrapper::ccnLoop, this);
@@ -90,8 +94,9 @@
 {
   ccn_charbuf *temp = ccn_charbuf_create ();
   m_keyStore = ccn_keystore_create ();
-  ccn_charbuf_putf (temp, "%s/.ccnx/.ccnx_keystore", getenv("HOME"));
-  ccn_keystore_init (m_keyStore, ccn_charbuf_as_string(temp), (char*)"Th1s1sn0t8g00dp8ssw0rd.");
+	string keyStoreFile = string(getenv("HOME")) + string("/.ccnx/.ccnx_keystore");
+  if (ccn_keystore_init (m_keyStore, (char *)keyStoreFile.c_str(), (char*)"Th1s1sn0t8g00dp8ssw0rd.") < 0) 
+		BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str(keyStoreFile.c_str()));
   ccn_charbuf_destroy (&temp);
 }
 
@@ -136,11 +141,14 @@
 			 freshness,
 			 NULL,
 			 m_keyLoactor);
-  ccn_encode_ContentObject(content, pname, signed_info,
+  if(ccn_encode_ContentObject(content, pname, signed_info,
 			   dataBuffer.c_str(), dataBuffer.length (),
-			   NULL, getPrivateKey());
+			   NULL, getPrivateKey()) < 0)
+		BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("encode content failed"));
+
   recursive_mutex::scoped_lock lock(m_mutex);
-  ccn_put(m_handle, content->buf, content->length);
+  if (ccn_put(m_handle, content->buf, content->length) < 0)
+		BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("ccnput failed"));
 
   ccn_charbuf_destroy (&pname);
   ccn_charbuf_destroy (&signed_info);
@@ -205,7 +213,9 @@
 
   char *pcontent;
   size_t len;
-  ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E], info->pco, (const unsigned char **)&pcontent, &len);
+  if (ccn_content_get_value(info->content_ccnb, info->pco->offset[CCN_PCO_E], info->pco, (const unsigned char **)&pcontent, &len) < 0)
+		BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("decode ContentObject failed"));
+
   string name;
   for (int i = 0; i < info->content_comps->n - 1; i++)
     {
@@ -213,7 +223,7 @@
       size_t size;
       name += "/";
       ccn_name_comp_get(info->content_ccnb, info->content_comps, i, (const unsigned char **)&comp, &size);
-      name += comp; // this will also crash if name doesn't have \0 ending
+      name += comp; 
     }
   // this will crash when content doesn't have \0 ending
   (*f) (name, (string)pcontent);
@@ -230,7 +240,8 @@
   
   dataClosure->p = &incomingData;
   recursive_mutex::scoped_lock lock(m_mutex);
-  ccn_express_interest (m_handle, pname, dataClosure, NULL);
+  if (ccn_express_interest (m_handle, pname, dataClosure, NULL) < 0)
+		BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("express interest failed"));
 
   ccn_charbuf_destroy (&pname);
 }
@@ -243,7 +254,8 @@
   ccn_name_from_uri (pname, prefix.c_str());
   interestClosure->data = new InterestCallback (interestCallback); // should be removed when closure is removed
   interestClosure->p = &incomingInterest;
-  ccn_set_interest_filter (m_handle, pname, interestClosure);
+  if(ccn_set_interest_filter (m_handle, pname, interestClosure) < 0)
+		BOOST_THROW_EXCEPTION(CcnxOperationException() << errmsg_info_str("set interest filter failed"));
 
   ccn_charbuf_destroy(&pname);
 }