Skip to content

Commit a7de210

Browse files
authored
fix(cloud9): "Failed to run command: aws.viewLogsAtMessage" #4296
Problem: "View Toolkit Logs" command may show an error in Cloud9: 2024-01-18 00:33:13 [ERROR]: aws.viewLogsAtMessage: Error: Command 'workbench.action.files.revert' not found. The `workbench.action.files.revert` command has existed since at least 2017, and definitely exists in vscode 1.68... microsoft/vscode@9e5c7d0 Solution: "workbench.action.files.revert" is not critical to openLogId(), so just log if it fails.
1 parent 8ab915a commit a7de210

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/shared/logger/commands.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as vscode from 'vscode'
77
import { Logger } from '.'
88
import { telemetry } from '../telemetry/telemetry'
99
import { Commands } from '../vscode/commands2'
10+
import { getLogger } from './logger'
1011

1112
function revealLines(editor: vscode.TextEditor, start: number, end: number): void {
1213
const startPos = editor.document.lineAt(start).range.start
@@ -45,7 +46,9 @@ export class Logging {
4546
// HACK: editor.document.getText() may return "stale" content, then
4647
// subsequent calls to openLogId() fail to highlight the specific log.
4748
// Invoke "revert" on the current file to force vscode to read from disk.
48-
await vscode.commands.executeCommand('workbench.action.files.revert')
49+
await vscode.commands.executeCommand('workbench.action.files.revert').then(undefined, (e: Error) => {
50+
getLogger().warn('command failed: "workbench.action.files.revert"')
51+
})
4952

5053
// Retrieve where the message starts by counting number of newlines
5154
const text = editor.document.getText()

0 commit comments

Comments
 (0)