Fetching variables isn't handling 404 error requests for Variables
in GHES versions before 3.8
#71
Labels
bug
Something isn't working
Describe the bug
Whenever I open a workflow connected to GHES 3.7, I get the following error message (sensitive data hidden by
***
). This is because theVariables
support was introduced on GHES 3.8.To Reproduce
Steps to reproduce the behavior:
https://<ghes_url>/api/v3/repos/<user>/<repo>/actions/variables
Expected behavior
Either detect whether the server supports this request or waive this error without throwing it considering that the server may not support this.
Screenshots
If applicable, add screenshots to help explain your problem.
Package/Area
Package Version
v0.3.9
Additional context
I recently reported github/vscode-github-actions#313. I noticed their repo uses
@actions/languageserver
, and after some investigation, I found that the root cause for unhandled 404 error requests forVariables
might be related to the code below - based on the error message I'm getting (line 142).languageservices/languageserver/src/context-providers/variables.ts
Lines 127 to 145 in 5dbaa88
The only place I can see this function being called is inside
getRemoteVariables
, which is also only used in the code below (line 47).languageservices/languageserver/src/context-providers/variables.ts
Lines 46 to 97 in 5dbaa88
However, the error should be caught by:
languageservices/languageserver/src/context-providers/variables.ts
Lines 91 to 97 in 5dbaa88
And the error would be waived. But it looks like the error isn't handled properly for
e.name == "HttpError" && e.status == 404
and the error is thrown anyway.Blaming the file, I see 41436c6 might have shadowed the case where the context is still returned and a log message is displayed. I'm not 100% confident of this because I don't know if the error thrown for 404 is NOT a
RequestError
, but that's the only reason I could think of.Thanks for the language server :) amazing work here
The text was updated successfully, but these errors were encountered: