Skip to content

Commit 0b169a8

Browse files
authored
telemetry(amazonq): add an error code for when node validation fails. (aws#7254)
## Problem These errors show up in telemetry with reason `Error`. All of the `reasonDesc` are different since they include unique PID values. This makes it hard to count/quantify how often this is happening. ## Solution - attach a unique error code to these errors. For when node can't be run we have `FailedToRunNode`, and when the language server can't be started we have `FailedToStartLanguageServer`. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 710f25c commit 0b169a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/core/src/shared/lsp/utils/platform.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function validateNodeExe(nodePath: string[], lsp: string, args: str
4040
if (!ok) {
4141
const msg = `failed to run basic "node -e" test (exitcode=${r.exitCode}): ${proc.toString(false, true)}`
4242
logger.error(msg)
43-
throw new ToolkitError(`amazonqLsp: ${msg}`)
43+
throw new ToolkitError(`amazonqLsp: ${msg}`, { code: 'FailedToRunNode' })
4444
}
4545

4646
// Check that we can start `node …/lsp.js --stdio …`.
@@ -68,7 +68,8 @@ export async function validateNodeExe(nodePath: string[], lsp: string, args: str
6868
})
6969
if (!ok2 || selfExit) {
7070
throw new ToolkitError(
71-
`amazonqLsp: failed to run (exitcode=${lspProc.exitCode()}): ${lspProc.toString(false, true)}`
71+
`amazonqLsp: failed to run (exitcode=${lspProc.exitCode()}): ${lspProc.toString(false, true)}`,
72+
{ code: 'FailedToStartLanguageServer' }
7273
)
7374
}
7475
} finally {

0 commit comments

Comments
 (0)