security: remove dead code in KeyChain::setDefaultCertificate

Change-Id: Ic38e5337a4d9526863dcb728f96f1c19f036182d
Refs: #4273
diff --git a/src/security/v2/key-chain.cpp b/src/security/v2/key-chain.cpp
index b63287d..9f14402 100644
--- a/src/security/v2/key-chain.cpp
+++ b/src/security/v2/key-chain.cpp
@@ -341,13 +341,7 @@
 {
   BOOST_ASSERT(static_cast<bool>(key));
 
-  try {
-    addCertificate(key, cert);
-  }
-  catch (const Pib::Error&) { // force to overwrite the existing certificates
-    key.removeCertificate(cert.getName());
-    addCertificate(key, cert);
-  }
+  addCertificate(key, cert);
   key.setDefaultCertificate(cert.getName());
 }
 
diff --git a/src/security/v2/key-chain.hpp b/src/security/v2/key-chain.hpp
index 59bf8fb..b5219da 100644
--- a/src/security/v2/key-chain.hpp
+++ b/src/security/v2/key-chain.hpp
@@ -62,11 +62,7 @@
   class LocatorMismatchError : public Error
   {
   public:
-    explicit
-    LocatorMismatchError(const std::string& what)
-      : Error(what)
-    {
-    }
+    using Error::Error;
   };
 
   /**
@@ -75,11 +71,7 @@
   class InvalidSigningInfoError : public Error
   {
   public:
-    explicit
-    InvalidSigningInfoError(const std::string& what)
-      : Error(what)
-    {
-    }
+    using Error::Error;
   };
 
   /**
@@ -99,10 +91,10 @@
    *
    * @sa manpage ndn-client.conf
    *
-   * @param pibLocator PIB locator, e.g., pib-sqlite3:/example/dir
-   * @param tpmLocator TPM locator, e.g., tpm-memory:
-   * @param allowReset if true, the PIB will be reset when the supplied tpmLocator
-   *        mismatches the one in PIB
+   * @param pibLocator PIB locator, e.g., `pib-sqlite3:/example/dir`
+   * @param tpmLocator TPM locator, e.g., `tpm-memory:`
+   * @param allowReset if true, the PIB will be reset when the supplied @p tpmLocator
+   *                   does not match the one in the PIB
    */
   KeyChain(const std::string& pibLocator, const std::string& tpmLocator, bool allowReset = false);
 
@@ -229,9 +221,10 @@
    * certificate if it has the same name (without considering implicit digest).
    *
    * @pre @p key must be valid.
+   * @throw std::invalid_argument @p key does not match @p certificate
    */
   void
-  setDefaultCertificate(const Key& key, const Certificate& cert);
+  setDefaultCertificate(const Key& key, const Certificate& certificate);
 
 public: // signing
   /**
@@ -303,7 +296,7 @@
 
 public: // export & import
   /**
-   * @brief export a certificate of name @p certificateName and its corresponding private key.
+   * @brief Export a certificate and its corresponding private key.
    *
    * @param certificate The certificate to export.
    * @param pw The password to secure the private key.