Adding codes to handle no ndnd exception
diff --git a/src/contact-manager.cpp b/src/contact-manager.cpp
index 371a317..eac5c51 100644
--- a/src/contact-manager.cpp
+++ b/src/contact-manager.cpp
@@ -26,16 +26,13 @@
INIT_LOGGER("ContactManager");
-ContactManager::ContactManager(Ptr<ContactStorage> contactStorage,
- Ptr<DnsStorage> dnsStorage,
- QObject* parent)
+ContactManager::ContactManager(QObject* parent)
: QObject(parent)
- , m_contactStorage(contactStorage)
- , m_dnsStorage(dnsStorage)
{
- setKeychain();
+ m_contactStorage = Ptr<ContactStorage>::Create();
+ m_dnsStorage = Ptr<DnsStorage>::Create();
- m_wrapper = Ptr<Wrapper>(new Wrapper(m_keychain));
+ setKeychain();
}
ContactManager::~ContactManager()
@@ -43,6 +40,16 @@
}
void
+ContactManager::setWrapper()
+{
+ try{
+ m_wrapper = Ptr<Wrapper>(new Wrapper(m_keychain));
+ }catch(ndn::Error::ndnOperation& e){
+ emit noNdnConnection(QString::fromStdString("Cannot conect to ndnd!\n Have you started your ndnd?"));
+ }
+}
+
+void
ContactManager::setKeychain()
{
Ptr<IdentityManager> identityManager = Ptr<IdentityManager>::Create();