Task #4273
closedRemove unused catch in KeyChain::setDefaultCertificate
100%
Description
When KeyChain::setDefaultCertificate
first calls addCertificate
, it catches Pib::Error
, presumably if the certificate already exists.
https://github.com/named-data/ndn-cxx/blob/6938e3461bc7b64531403b05d18d492d4713c641/src/security/v2/key-chain.cpp#L346
But addCertificate
never throws Pib::Error
because it replaces a certificate if it exists, as stated in the doc comment:
https://github.com/named-data/ndn-cxx/blob/80782e06cd2589d3e3f9926dcdb1a70480eaf7fe/src/security/v2/key-chain.hpp#L205
"This method overwrites certificate with the same name, without considering the implicit digest."
This is not a bug because setDefaultCertificate
still works. It just never executes the catch clause, which can be removed. (Feel free to abandon this issue if it doesn't matter to you.)