This repository has been archived by the owner on Sep 24, 2021. It is now read-only.
forked from microsoft/vscode-go
-
Notifications
You must be signed in to change notification settings - Fork 12
Unclear error when go binary is not found #16
Comments
simark
pushed a commit
to simark/go-language-server
that referenced
this issue
Feb 23, 2018
If the go binary is not available from the PATH, the server outputs this error message. server --> client: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"[lspserver] (node:17641) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: \\"file\\" argument must be a non-empty string"}}' server --> client: b'{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"[lspserver] (node:17641) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code."}}' The TypeError comes from node's child_process.execFile when the vscode-go code tries to run the go binary, because goRuntimePath's value is undefined. This patch makes updateGoPathGoRootFromConfig return a rejected promise with a meaningful error message when the go binary is not found, and then makes the server send an error message to the client including the error and backtrace. The result looks like this: server --> client: b'{"jsonrpc":"2.0","method":"window/showMessage","params":{"type":1,"message":"Error: Cannot find \\"go\\" binary. Update PATH or GOROOT appropriately\\n at Object.updateGoPathGoRootFromConfig (/home/emaisin/src/go-language-server/out/src/goInstallTools.js:280:31)\\n at Object.<anonymous> (/home/emaisin/src/go-language-server/out/src-vscode-mock/activate.js:105:33)\\n at Generator.next (<anonymous>)\\n at /home/emaisin/src/go-language-server/out/src-vscode-mock/activate.js:13:71\\n at new Promise (<anonymous>)\\n at __awaiter (/home/emaisin/src/go-language-server/out/src-vscode-mock/activate.js:9:12)\\n at Object.activate (/home/emaisin/src/go-language-server/out/src-vscode-mock/activate.js:34:12)\\n at LspServer.<anonymous> (/home/emaisin/src/go-language-server/out/src-vscode-mock/lsp-server.js:93:31)\\n at Generator.next (<anonymous>)\\n at /home/emaisin/src/go-language-server/out/src-vscode-mock/lsp-server.js:13:71"}}' It's not very readable as-is, but I suppose that when the client prints it in a log, the \n will be presented as real line breaks. But the important thing is that the info is there, so that one has a lead to start debugging. There was another instance (in runTool) where the result of getGoRuntimePath was not checked, so it generated a similar unclear error. Fixes theia-ide#16 Signed-off-by: Simon Marchi <[email protected]>
Fixed upstream and rebased |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When trying to use the server, I got this error:
and the server wouldn't reply anything. After some debugging, I found that it was because it didn't find the go binary. The rejected promise should be handled to avoid that warning, and a better error message should be given to the user to indicate what to fix.
The text was updated successfully, but these errors were encountered: