// Use of this source code is governed by an apache-2.0 license that can be
// found in the LICENSE file.
+#include <boost/exception/diagnostic_information.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/program_options.hpp>
initial = true;
bpo::notify(opt_map);
uid = opt_map["uid"].as<int>();
- } catch (const bpo::error& error) {
- std::cerr << error.what() << std::endl;
- return -1;
- } catch (const boost::bad_any_cast& error) {
- std::cerr << error.what() << std::endl;
- return -1;
- } catch (const boost::bad_lexical_cast& error) {
- std::cerr << error.what() << std::endl;
- return -1;
+ } catch (const boost::exception& error) {
+ std::cerr << "Exception occured: " << boost::diagnostic_information(error)
+ << std::endl;
}
RemoveOldDatabases(uid);
for (bf::directory_iterator iter(recovery_dir);
iter != bf::directory_iterator();
++iter) {
- try {
- if (bf::is_directory(iter->path()))
- continue;
- } catch (const bf::filesystem_error& e) {
- LOG(ERROR) << "Failed to get is_directory result: " << e.what();
+ if (bf::is_directory(iter->path()))
continue;
- }
std::string file = iter->path().filename().string();
std::regex recovery_regex(kRecoveryFilePattern);
std::smatch match;
int main() {
uid_t uid = getuid();
- DoRecoveryProcess(uid);
- if (ci::IsAdminUser(uid))
- DoRecoveryProcess(kGlobalUserUid);
+ try {
+ DoRecoveryProcess(uid);
+ if (ci::IsAdminUser(uid))
+ DoRecoveryProcess(kGlobalUserUid);
+ } catch (const bf::filesystem_error& e) {
+ LOG(ERROR) << "Exception occurred: " << e.what();
+ return -1;
+ }
return 0;
}