Use current_exception to catch all exceptions 28/125728/5
authorSangyoon Jang <s89.jang@samsung.com>
Tue, 18 Apr 2017 12:22:47 +0000 (21:22 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Wed, 19 Apr 2017 02:08:03 +0000 (19:08 -0700)
Change-Id: I0a9a165a82367d911706702eaba162d60717c4f2
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
src/pkg_initdb/pkg_initdb.cc
src/pkg_recovery/pkg_recovery_helper.cc

index 8f50bab..2246d37 100644 (file)
@@ -156,9 +156,10 @@ int main(int argc, char *argv[]) {
       initial = true;
     bpo::notify(opt_map);
     uid = opt_map["uid"].as<int>();
-  } catch (const boost::exception& error) {
-    std::cerr << "Exception occured: " << boost::diagnostic_information(error)
-              << std::endl;
+  } catch (...) {
+    std::cerr << "Exception occurred: "
+              << boost::current_exception_diagnostic_information() << std::endl;
+    return -1;
   }
 
   RemoveOldDatabases(uid);
index 50875e9..e5a55cb 100644 (file)
@@ -126,8 +126,9 @@ int main() {
           LOG(ERROR) << "Failed to recover installation: " << entry.second;
       }
     }
-  } catch (const bf::filesystem_error& e) {
-    LOG(ERROR) << "Exception occurred: " << e.what();
+  } catch (...) {
+    std::cerr << "Exception occurred: "
+              << boost::current_exception_diagnostic_information() << std::endl;
     return -1;
   }
   return 0;