diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-12-22 21:24:16 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-12-22 21:24:16 +0000 |
commit | 0b509d458b2ef3c5c525b7e5e2e66352285c7d91 (patch) | |
tree | 1fee962fa4a8ec458dbc61ac29f57151f3e3991d /lib | |
parent | d18f1a336d8cf1760aaafb95cec6bbf43a7d637e (diff) |
Catch and log exceptions in the HousekeepStoreAccount destructor.
Destructors aren't supposed to throw exceptions, and they can be called
while cleaning up from a previous exception, which will terminate the
application, so just log the error and carry on.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backupstore/HousekeepStoreAccount.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/backupstore/HousekeepStoreAccount.cpp b/lib/backupstore/HousekeepStoreAccount.cpp index e5bd3cbb..c965dd17 100644 --- a/lib/backupstore/HousekeepStoreAccount.cpp +++ b/lib/backupstore/HousekeepStoreAccount.cpp @@ -81,7 +81,17 @@ HousekeepStoreAccount::~HousekeepStoreAccount() { if(mapNewRefs.get()) { - mapNewRefs->Discard(); + // Discard() can throw exception, but destructors aren't supposed to do that, so + // just catch and log them. + try + { + mapNewRefs->Discard(); + } + catch(BoxException &e) + { + BOX_ERROR("Failed to destroy housekeeper: discarding the refcount " + "database threw an exception: " << e.what()); + } } } |