log filename when failing to parse facts
authorNikhil Thomas <[email protected]>
Thu, 30 Oct 2025 21:45:16 +0000 (30 14:45 -0700)
committermeta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
Thu, 30 Oct 2025 21:45:16 +0000 (30 14:45 -0700)
Summary: TSIA: improve debuggability when the unit parser fails.

Reviewed By: ricklavoie

Differential Revision: D85798620

fbshipit-source-id: 1d03f40a508841551bfb42fe19005c2d60ab863f

hphp/runtime/vm/unit-parser.cpp

index 787fc50..690f1e2 100644 (file)
@@ -221,7 +221,13 @@ ParseFactsResult extract_facts(
     throwErrno("Failed to extract facts: Could not get FileStreamWrapper.");
   }
   const auto f = w->open(StrNR(filename), "r", 0, nullptr);
-  if (!f) throwErrno("Failed to extract facts: Could not read source code.");
+  if (!f) { 
+    throwErrno(
+      folly::sformat(
+        "Failed to extract facts: Could not read source code for %s", 
+        filename
+      ).c_str());
+  }
   auto const str = f->read();
   auto const source_text = str.get()->slice();
   auto actual_sha1 = string_sha1(source_text);