Skip to content

Commit 8284e22

Browse files
committed
Report errors from FindFile
There is only one caller, and it looks like it was prepared to handle errors already in the empty-string format. https://github.com/google/android-cuttlefish/blob/4478181bf5fab943de83e7efea3fe2ecd981253b/base/cvd/cuttlefish/host/commands/assemble_cvd/vendor_dlkm_utils.cc#L437 Bug: b/491924689
1 parent 0f89cd5 commit 8284e22

File tree

1 file changed

+4
-1
lines changed
  • base/cvd/cuttlefish/common/libs/utils

1 file changed

+4
-1
lines changed

base/cvd/cuttlefish/common/libs/utils/files.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,10 @@ Result<std::string> FindFile(const std::string& path,
621621
}
622622
return {};
623623
};
624-
return WalkDirectory(path, callback).ok() ? "" : ret;
624+
CF_EXPECT(WalkDirectory(path, callback));
625+
CF_EXPECTF(!ret.empty(), "No file matching '{}' found in '{}'", target_name,
626+
path);
627+
return ret;
625628
}
626629

627630
// Recursively enumerate files in |dir|, and invoke the callback function with

0 commit comments

Comments
 (0)