tlbmc: Use non-throwing filesystem APIs in uhmm_i2c_walker

Google-Bug-Id:478925741
PiperOrigin-RevId: 981489408
Change-Id: I3cab8b22fb746280a1a77f857dab92f19f867317
diff --git a/tlbmc/deterministic_bmc/i2c_walker/uhmm_i2c_walker.cc b/tlbmc/deterministic_bmc/i2c_walker/uhmm_i2c_walker.cc
index 06a6314..e2f17da 100644
--- a/tlbmc/deterministic_bmc/i2c_walker/uhmm_i2c_walker.cc
+++ b/tlbmc/deterministic_bmc/i2c_walker/uhmm_i2c_walker.cc
@@ -53,7 +53,16 @@
   // for more details.
   std::string root_bus_path =
       absl::StrCat(root_directory, "/sys/bus/i2c/devices/i2c-", root_bus);
-  if (!std::filesystem::exists(root_bus_path)) {
+  std::error_code error_code;
+  if (!std::filesystem::exists(root_bus_path, error_code)) {
+    if (error_code) {
+      std::string error_message = absl::StrCat(
+          "Root bus path ", root_bus_path,
+          " does not exist or filesystem::exists() failed with error: ",
+          error_code.message());
+      LOG(ERROR) << error_message;
+      return absl::NotFoundError(error_message);
+    }
     return absl::NotFoundError(
         absl::StrCat("Root bus path ", root_bus_path, " does not exist."));
   }
@@ -62,7 +71,6 @@
       absl::Hex(mux_address_identifier.address(), absl::kZeroPad4));
   std::string mux_path =
       absl::StrCat(root_bus_path, "/", root_bus, "-", mux_address_hex);
-  std::error_code error_code;
   if (!std::filesystem::exists(mux_path, error_code)) {
     std::string error_message = absl::StrCat(
         "Mux path ", mux_path,