Adding part of exception handling
diff --git a/src/addcontactpanel.cpp b/src/addcontactpanel.cpp
index bea8d7f..c5c80e4 100644
--- a/src/addcontactpanel.cpp
+++ b/src/addcontactpanel.cpp
@@ -12,7 +12,7 @@
#include "ui_addcontactpanel.h"
#ifndef Q_MOC_RUN
-#include <cryptopp/base64.h>
+// #include <cryptopp/base64.h>
// #include <ndn.cxx/helpers/der/der.h>
#include <ndn.cxx/helpers/der/visitor/simple-visitor.h>
#include "logging.h"
@@ -125,7 +125,13 @@
AddContactPanel::onAddClicked()
{
ContactItem contactItem(*m_currentEndorseCertificate);
- m_contactManager->getContactStorage()->addContact(contactItem);
+ try{
+ m_contactManager->getContactStorage()->addContact(contactItem);
+ }catch(exception& e){
+ m_warningDialog->setMsg(e.what());
+ m_warningDialog->show();
+ return;
+ }
emit newContactAdded();
this->close();
}
@@ -216,11 +222,9 @@
Ptr<ContactItem> contact = m_contactManager->getContact(signerName);
if(contact == NULL)
continue;
- _LOG_DEBUG("get contact: " << signerName.toUri());
if(!contact->isIntroducer() || !contact->canBeTrustedFor(m_currentEndorseCertificate->getProfileData()->getIdentityName()))
continue;
- _LOG_DEBUG("contact can be trusted");
if(!security::PolicyManager::verifySignature(*data, contact->getSelfEndorseCertificate().getPublicKeyInfo()))
continue;
@@ -229,15 +233,10 @@
if(profileBlob != tmpProfileBlob)
continue;
- _LOG_DEBUG("Profile equal");
-
const vector<string>& endorseList = endorseCert->getEndorseList();
vector<string>::const_iterator it = endorseList.begin();
for(; it != endorseList.end(); it++)
- {
- _LOG_DEBUG("Entry: " << *it);
- endorseCount[*it] += 1;
- }
+ endorseCount[*it] += 1;
}
}