From 382231a003f862d203892e8170b81d86d9d55bbd Mon Sep 17 00:00:00 2001 From: Lucian Wischik Date: Tue, 5 Dec 2017 07:41:30 -0800 Subject: [PATCH] lsp: catch error returned from a dialog Summary: Logs show the commonest error experienced by clientLsp is when a response comes back from a showMessageRequest, but the response isn't the expected MessageActionItem object. I'm not sure what exactly triggers this. Maybe it's when the user dismisses the dialog and the LSP client sends back an empty response? Or maybe it's when the LSP server requests the showMessageRequest to be cancelled, and the server responds back with a CancelledError as expected? In any case, I'm just going to catch this kind of issue because it's not really an error and shouldn't show up in the logs as such. (Note: the behavior of `Hh_json_helpers.get_string_val` is to throw an exception if it's being asked to operate on something that isn't a JSON_Object). Reviewed By: arxanas Differential Revision: D6471582 fbshipit-source-id: 44b16acdb25380359641b5846e8efec2c9e70e00 --- hphp/hack/src/client/clientLsp.ml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hphp/hack/src/client/clientLsp.ml b/hphp/hack/src/client/clientLsp.ml index 60a877379b4..1341f5dfe1c 100644 --- a/hphp/hack/src/client/clientLsp.ml +++ b/hphp/hack/src/client/clientLsp.ml @@ -1325,8 +1325,7 @@ and do_lost_server (state: state) ?(allow_immediate_reconnect = true) (p: Lost_e in let handle_result ~result state = let state = state |> clear_dialog_flag in - let result = Option.value_map result ~default:"" - ~f:(Hh_json_helpers.get_string_val "title" ~default:"") in + let result = Lsp_fmt.Jget.string_d result "title" ~default:"" in match result, state with | "Restart", Lost_server _ -> if p.start_on_click then begin -- 2.11.4.GIT