Fix error log when failed MoveDir() and MoveFile() 07/324207/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 14 May 2025 04:21:36 +0000 (13:21 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 14 May 2025 04:42:26 +0000 (13:42 +0900)
Change-Id: I29cc079e9de64279c5e9794e777de9521d4d5da1
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/utils/file_util.cc

index 47888f829ed2a2717dce97342634006ccea71646..be31b7cf683f41f2d763ec39a184f564be0785ae 100644 (file)
@@ -366,7 +366,8 @@ bool MoveDir(const fs::path& src, const fs::path& dst, FSFlag flags) {
     }
     fs::remove_all(src, error);
     if (error) {
-      LOG(ERROR) << "Cannot remove old directory when coping: " << src;
+      LOG(ERROR) << "Cannot remove old directory when coping: " << src
+          << " with error [" << error.message() << "]";
       return false;
     }
   }
@@ -384,13 +385,13 @@ bool MoveFile(const fs::path& src, const fs::path& dst, bool force) {
     fs::copy_file(src, dst, fs::copy_options::overwrite_existing, error);
     if (error) {
       LOG(WARNING) << "Cannot copy file " << src <<
-          " due to error [" << error << "]";
+          " due to error [" << error.message() << "]";
       return false;
     }
     fs::remove_all(src, error);
     if (error) {
       LOG(ERROR) << "Cannot remove old file when coping: " << src <<
-          "with error [" << error << "]";
+          "with error [" << error.message() << "]";
     }
   }
   return true;