From b7d4a715aa1f278e4322faad2d0159f8820218d5 Mon Sep 17 00:00:00 2001 From: Catherine Gasnier Date: Mon, 25 Nov 2024 05:27:04 -0800 Subject: [PATCH] Error streaming: Log more when failing to get field `files` from watchman response. Summary: Some user has reported this error, so logging more, since I couldn't get their logs: ``` Watchman failure. Hh_json_helpers.Jget.Parse("files") Raised at Hh_json_helpers.Jget.get_exn in file "fbcode/hphp/hack/src/utils/hh_json/hh_json_helpers.ml" (inlined), line 55, characters 14-31 Called from Hh_json_helpers.Jget.array_exn in file "fbcode/hphp/hack/src/utils/hh_json/hh_json_helpers.ml" (inlined), line 117, characters 18-35 Called from Hh_json_helpers.Jget.string_array_exn in file "fbcode/hphp/hack/src/utils/hh_json/hh_json_helpers.ml", line 123, characters 4-22 Called from ClientCheckStatus.watchman_get_raw_updates_since.(fun) in file "fbcode/hphp/hack/src/client/clientCheckStatus.ml", line 324, characters 18-75 ``` Differential Revision: D66300063 fbshipit-source-id: 1beadecbf3723e13c78a54092b8c721f2efd493e --- hphp/hack/src/client/clientCheckStatus.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hphp/hack/src/client/clientCheckStatus.ml b/hphp/hack/src/client/clientCheckStatus.ml index e4840edf918af3..be6f1e6b4b02b3 100644 --- a/hphp/hack/src/client/clientCheckStatus.ml +++ b/hphp/hack/src/client/clientCheckStatus.ml @@ -405,7 +405,14 @@ let watchman_get_raw_updates_since match files with | Error e -> let msg = Exception.to_string e in - Hh_logger.log "watchman parse failure: %s\nRESPONSE:%s\n" msg stdout; + let msg = + Printf.sprintf + "ClientCheckStatus: watchman parse failure. Expected field `files`.\n%s\nRESPONSE:%s\n" + msg + stdout + in + Hh_logger.log "%s" msg; + HackEventLogger.invariant_violation_bug msg; Lwt.return_error msg | Ok (json, files) -> let has_changed = ref false in