2525#include < memory>
2626
2727#include " backend.h"
28- #include " my_dbug.h"
2928
3029#include < mysql/components/minimal_chassis.h>
3130
@@ -47,15 +46,13 @@ using keyring_common::utils::get_random_data;
4746
4847Keyring_kmip_backend::Keyring_kmip_backend (config::Config_pod const &config)
4948 : valid_(false ), config_(config) {
50- DBUG_TRACE;
5149 valid_ = true ;
5250}
5351
5452bool Keyring_kmip_backend::load_cache (
5553 keyring_common::operations::Keyring_operations<
5654 Keyring_kmip_backend, keyring_common::data::Data_extension<IdExt>>
5755 &operations) {
58- DBUG_TRACE;
5956 // We have to load keys and secrets with state==ACTIVE only
6057 // TODO: implement better logic with the new KMIP library
6158 try {
@@ -126,9 +123,16 @@ bool Keyring_kmip_backend::load_cache(
126123 return true ;
127124 }
128125 }
129-
126+ } catch (const std::exception &e) {
127+ std::string err_msg = std::string (" std exception in function '" ) +
128+ __func__ + " ': " + e.what ();
129+ LogComponentErr (ERROR_LEVEL, ER_LOG_PRINTF_MSG, err_msg.c_str ());
130+ return true ;
130131 } catch (...) {
131- mysql_components_handle_std_exception (__func__);
132+ std::string err_msg =
133+ std::string (" Unknown exception in function '" ) + __func__ + ' \' ' ;
134+ LogComponentErr (ERROR_LEVEL, ER_LOG_PRINTF_MSG, err_msg.c_str ());
135+ return true ;
132136 }
133137
134138 return false ;
@@ -137,13 +141,11 @@ bool Keyring_kmip_backend::load_cache(
137141bool Keyring_kmip_backend::get (const Metadata &, Data &) const {
138142 /* Shouldn't have reached here if we cache things. */
139143 assert (0 );
140- DBUG_TRACE;
141144 return false ;
142145}
143146
144147bool Keyring_kmip_backend::store (const Metadata &metadata,
145148 Data_extension<IdExt> &data) {
146- DBUG_TRACE;
147149 if (!metadata.valid () || !data.valid ()) return true ;
148150 kmippp::context::id_t id;
149151 try {
@@ -184,8 +186,15 @@ bool Keyring_kmip_backend::store(const Metadata &metadata,
184186 return true ;
185187 }
186188 data.set_extension ({id});
189+ } catch (const std::exception &e) {
190+ std::string err_msg = std::string (" std exception in function '" ) +
191+ __func__ + " ': " + e.what ();
192+ LogComponentErr (ERROR_LEVEL, ER_LOG_PRINTF_MSG, err_msg.c_str ());
193+ return true ;
187194 } catch (...) {
188- mysql_components_handle_std_exception (__func__);
195+ std::string err_msg =
196+ std::string (" Unknown exception in function '" ) + __func__ + ' \' ' ;
197+ LogComponentErr (ERROR_LEVEL, ER_LOG_PRINTF_MSG, err_msg.c_str ());
189198 return true ;
190199 }
191200 return false ;
@@ -204,15 +213,21 @@ size_t Keyring_kmip_backend::size() const {
204213 return keys.size () + secrets.size ();
205214 // we may have deactivated keys counted, so we need to count active keys only
206215 // TODO: implement better logic with the new KMIP library
216+ } catch (const std::exception &e) {
217+ std::string err_msg = std::string (" std exception in function '" ) +
218+ __func__ + " ': " + e.what ();
219+ LogComponentErr (ERROR_LEVEL, ER_LOG_PRINTF_MSG, err_msg.c_str ());
220+ return 0 ;
207221 } catch (...) {
208- mysql_components_handle_std_exception (__func__);
222+ std::string err_msg =
223+ std::string (" Unknown exception in function '" ) + __func__ + ' \' ' ;
224+ LogComponentErr (ERROR_LEVEL, ER_LOG_PRINTF_MSG, err_msg.c_str ());
209225 return 0 ;
210226 }
211227}
212228
213229bool Keyring_kmip_backend::erase (const Metadata &metadata,
214230 Data_extension<IdExt> &data) {
215- DBUG_TRACE;
216231 if (!metadata.valid ()) return true ;
217232
218233 auto ctx = kmip_ctx ();
@@ -238,7 +253,6 @@ bool Keyring_kmip_backend::erase(const Metadata &metadata,
238253bool Keyring_kmip_backend::generate (const Metadata &metadata,
239254 Data_extension<IdExt> &data,
240255 size_t length) {
241- DBUG_TRACE;
242256 if (!metadata.valid ()) return true ;
243257
244258 std::unique_ptr<unsigned char []> key (new unsigned char [length]);
0 commit comments