Fix uncaught exception.
Change-Id: Ib2526443fcc27fd615fb9325282dbfd3515e9844
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
(cherry picked from commit
140ba528998c7fa6f607bb081bca66a1e9518034)
}
bool Remove(const bf::path& path) {
}
bool Remove(const bf::path& path) {
- if (!exists(path) && !bf::is_symlink(bf::symlink_status(path)))
+ bs::error_code error;
+ if (!exists(path, error)) {
+ if (error) {
+ LOG(ERROR) << "Cannot remove: " << path << ", " << error.message();
+ return false;
+ }
+ return true;
+ }
+ if (!bf::is_symlink(bf::symlink_status(path)))
if (error) {
LOG(ERROR) << "Cannot remove: " << path << ", " << error.message();
return false;
if (error) {
LOG(ERROR) << "Cannot remove: " << path << ", " << error.message();
return false;
void PkgRecoveryService::SearchBackupFiles(uid_t uid) {
const bf::path recovery_dir = ci::GetRootAppPath(false, uid);
void PkgRecoveryService::SearchBackupFiles(uid_t uid) {
const bf::path recovery_dir = ci::GetRootAppPath(false, uid);
- for (bf::directory_iterator iter(recovery_dir);
- iter != bf::directory_iterator();
- ++iter) {
- try {
+ try {
+ for (bf::directory_iterator iter(recovery_dir);
+ iter != bf::directory_iterator();
+ ++iter) {
+
std::string file = iter->path().filename().string();
std::regex backup_regex(kBackupFilePattern);
std::smatch match;
std::string file = iter->path().filename().string();
std::regex backup_regex(kBackupFilePattern);
std::smatch match;
else
bf::rename(iter->path(), orig_file);
}
else
bf::rename(iter->path(), orig_file);
}
- } catch (...) {
- LOG(WARNING) << "Exception occurred: "
- << boost::current_exception_diagnostic_information();
- continue;
+ } catch (...) {
+ LOG(WARNING) << "Exception occurred: "
+ << boost::current_exception_diagnostic_information();