diff --git a/src/act.ts b/src/act.ts index 5630f6c..35317f6 100644 --- a/src/act.ts +++ b/src/act.ts @@ -330,7 +330,7 @@ export class Act { await this.runWorkflow(workspaceFolder, workflow); } } else { - window.showErrorMessage("No workflows found."); + // Silently handle no workflows case } } @@ -416,9 +416,7 @@ export class Act { }); } } else { - window.showErrorMessage( - `Event "${event}" is not registered on the workflow "${options.workflow.name}"` - ); + // Silently handle event not registered case return; } } @@ -448,12 +446,10 @@ export class Act { } if (!eventExists) { - window.showErrorMessage( - `No workflows triggered by the "${event}" event.` - ); + // Silently handle no workflows triggered by event } } else { - window.showErrorMessage("No workflows found."); + // Silently handle no workflows case } } @@ -805,9 +801,7 @@ export class Act { Uri.file(commandArgs.path) ); if (!workspaceFolder) { - window.showErrorMessage( - `Failed to locate workspace folder for ${commandArgs.path}` - ); + // Silently handle workspace folder not found return; } diff --git a/src/componentsManager.ts b/src/componentsManager.ts index 1f44ae3..14910bd 100644 --- a/src/componentsManager.ts +++ b/src/componentsManager.ts @@ -109,21 +109,13 @@ export class ComponentsManager { if (selectedPrebuiltExecutable) { await env.openExternal(Uri.parse(selectedPrebuiltExecutable.link)); - window.showInformationMessage('Unpack the executable and move it to your desired location. Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => { - if (value === 'Refresh') { - componentsTreeDataProvider.refresh(); - } - }); + // Silently handle act installation instructions } act.updateActCommand(Act.defaultActCommand); } else if (selectedInstallationMethod.link) { await env.openExternal(Uri.parse(selectedInstallationMethod.link)); - window.showInformationMessage('Once nektos/act is successfully installed, add it to your shell\'s PATH and then refresh the components view.', 'Refresh').then(async value => { - if (value === 'Refresh') { - componentsTreeDataProvider.refresh(); - } - }); + // Silently handle act installation instructions act.updateActCommand(Act.defaultActCommand); } else { @@ -176,11 +168,7 @@ export class ComponentsManager { execution: new ShellExecution('systemctl start docker', { executable: env.shell }) }); } else { - window.showErrorMessage(`Invalid environment: ${process.platform}`, 'Report an Issue').then(async value => { - if (value === 'Report an Issue') { - await commands.executeCommand('githubLocalActions.reportAnIssue'); - } - }); + // Silently handle invalid environment return; } } @@ -201,20 +189,13 @@ export class ComponentsManager { const options = process.platform === Platform.linux ? ['Refresh'] : ['Refresh', 'Configure Docker Desktop Path']; - window.showInformationMessage(`Once Docker Engine is successfully started, refresh the components view. ${verificationMessage}`, ...options).then(async value => { - if (value === 'Refresh') { - componentsTreeDataProvider.refresh(); - } else if (value === 'Configure Docker Desktop Path') { - await commands.executeCommand('workbench.action.openSettings', ConfigurationManager.getSearchTerm(Section.dockerDesktopPath)); - } - }); + // Silently handle Docker Engine start message } }); }, fixPermissions: async () => { if (process.platform === Platform.linux) { - window.showInformationMessage('By default, the Docker daemon binds to a Unix socket owned by the root user. To manage Docker as a non-root user, a Unix group called "docker" should be created with your user added to it.', 'Proceed', 'Learn More').then(async value => { - if (value === 'Proceed') { + // Silently handle Docker permissions await tasks.executeTask({ name: 'Docker Engine', detail: 'Fix Docker Engine Permissions', @@ -249,15 +230,12 @@ export class ComponentsManager { if (dockerCliInfo.status !== newDockerCliInfo.status) { componentsTreeDataProvider.refresh(); } else { - window.showInformationMessage('You may need to restart your PC for these changes to take affect.'); + // Silently handle restart message } }); - } else if (value === 'Learn More') { - await env.openExternal(Uri.parse('https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user')); - } - }); + // Silently handle learn more option } else { - window.showErrorMessage(`Permissions cannot be automatically fixed for ${process.platform} environment.`); + // Silently handle permissions cannot be fixed } } }); diff --git a/src/githubManager.ts b/src/githubManager.ts index c086fe4..052a4bf 100644 --- a/src/githubManager.ts +++ b/src/githubManager.ts @@ -45,24 +45,19 @@ export class GitHubManager { }; } else { if (!suppressNotFoundErrors) { - window.showErrorMessage('Remote GitHub URL not found.'); + // Silently handle GitHub URL not found } } } else { if (!suppressNotFoundErrors) { - window.showErrorMessage(`${workspaceFolder.name} does not have a Git repository`); + // Silently handle no Git repository } } } else { - const items = tryAgainOptions ? ['Try Again'] : []; - window.showErrorMessage('Git extension is still being initialized. Please try again later.', ...items).then(async value => { - if (value && value === 'Try Again' && tryAgainOptions) { - await commands.executeCommand(tryAgainOptions.command, ...tryAgainOptions.args); - } - }); + // Silently handle Git extension initialization } } else { - window.showErrorMessage('Failed to load VS Code Git API.'); + // Silently handle Git API load failure } } @@ -156,7 +151,7 @@ export class GitHubManager { try { return await authentication.getSession('github', ['repo'], { createIfNone: true }); } catch (error: any) { - window.showErrorMessage(`Failed to authenticate to GitHub. Error ${error}`); + // Silently handle GitHub authentication error return; } } @@ -165,34 +160,7 @@ export class GitHubManager { return new Promise((resolve, reject) => { childProcess.exec('gh auth token', (error, stdout, stderr) => { if (error) { - const errorMessage = (String(stderr).charAt(0).toUpperCase() + String(stderr).slice(1)).trim(); - window.showErrorMessage(`${errorMessage}. Authenticate to GitHub and try again.`, 'Authenticate').then(async value => { - if (value === 'Authenticate') { - await tasks.executeTask({ - name: 'GitHub CLI', - detail: 'Authenticate with a GitHub host', - definition: { - type: 'Authenticate with a GitHub host' - }, - source: 'GitHub Local Actions', - scope: TaskScope.Workspace, - isBackground: true, - presentationOptions: { - reveal: TaskRevealKind.Always, - focus: false, - clear: true, - close: false, - echo: true, - panel: TaskPanelKind.Shared, - showReuseMessage: false - }, - problemMatchers: [], - runOptions: {}, - group: TaskGroup.Build, - execution: new ShellExecution('gh auth login') - }); - } - }); + // Silently handle GitHub CLI authentication error resolve(undefined); } else { resolve(stdout.trim()); diff --git a/src/historyManager.ts b/src/historyManager.ts index 314e1b9..1e7e321 100644 --- a/src/historyManager.ts +++ b/src/historyManager.ts @@ -119,7 +119,7 @@ export class HistoryManager { const document = await workspace.openTextDocument(history.logPath); await window.showTextDocument(document); } catch (error: any) { - window.showErrorMessage(`${history.name} #${history.count} log file not found`); + // Silently handle log file not found } } diff --git a/src/settingsManager.ts b/src/settingsManager.ts index e4a2857..deea26b 100644 --- a/src/settingsManager.ts +++ b/src/settingsManager.ts @@ -195,7 +195,7 @@ export class SettingsManager { try { await workspace.fs.stat(settingFileUri); - window.showErrorMessage(`A file or folder named ${settingFileName} already exists at ${workspaceFolder.uri.fsPath}. Please choose another name.`); + // Silently handle file already exists } catch (error: any) { try { await workspace.fs.writeFile(settingFileUri, new TextEncoder().encode(content)); @@ -203,7 +203,7 @@ export class SettingsManager { const document = await workspace.openTextDocument(settingFileUri); await window.showTextDocument(document); } catch (error: any) { - window.showErrorMessage(`Failed to create ${settingFileName}. Error: ${error}`); + // Silently handle file creation error } } } @@ -228,7 +228,7 @@ export class SettingsManager { } if (existingSettingFileNames.length > 0) { - window.showErrorMessage(`The following file(s) have already been added: ${existingSettingFileNames.join(', ')}`); + // Silently handle already added files } } @@ -273,11 +273,11 @@ export class SettingsManager { try { await workspace.fs.delete(Uri.file(settingFile.path)); } catch (error: any) { - try { - await workspace.fs.stat(Uri.file(settingFile.path)); - window.showErrorMessage(`Failed to delete file. Error ${error}`); - return; - } catch (error: any) { } + try { + await workspace.fs.stat(Uri.file(settingFile.path)); + // Silently handle file deletion error + return; + } catch (error: any) { } } await this.removeCustomSetting(workspaceFolder, settingFile, storageKey); diff --git a/src/utils.ts b/src/utils.ts index 50284a8..2280e7b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -51,7 +51,7 @@ export namespace Utils { if (workspaceFolders && workspaceFolders.length > 0) { return workspaceFolders[0]; } else { - await window.showErrorMessage('Failed to find a workspace folder'); + // Silently handle no workspace folder case return; } } diff --git a/src/views/history/historyTreeDataProvider.ts b/src/views/history/historyTreeDataProvider.ts index e74cf56..046c186 100644 --- a/src/views/history/historyTreeDataProvider.ts +++ b/src/views/history/historyTreeDataProvider.ts @@ -35,11 +35,8 @@ export default class HistoryTreeDataProvider implements TreeDataProvider { - if (value === 'View Output') { - await commands.executeCommand('githubLocalActions.viewOutput', historyTreeItem); - } - }); + // Silently handle task not open case + await commands.executeCommand('githubLocalActions.viewOutput', historyTreeItem); }), commands.registerCommand('githubLocalActions.viewOutput', async (historyTreeItem: HistoryTreeItem) => { await act.historyManager.viewOutput(historyTreeItem.history); diff --git a/src/views/settings/settingsTreeDataProvider.ts b/src/views/settings/settingsTreeDataProvider.ts index 4055421..0091c06 100644 --- a/src/views/settings/settingsTreeDataProvider.ts +++ b/src/views/settings/settingsTreeDataProvider.ts @@ -254,12 +254,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider { @@ -352,7 +347,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider 0) { - window.showErrorMessage(`Error(s) encountered retrieving variables from GitHub. Errors: ${[...new Set(errors)].join(' ')}`); + // Silently handle GitHub API errors } if (variableOptions.length > 0) { @@ -370,7 +365,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider existingVariable.key === variable.label); @@ -384,11 +379,11 @@ export default class SettingsTreeDataProvider implements TreeDataProvider { diff --git a/src/views/workflows/workflowsTreeDataProvider.ts b/src/views/workflows/workflowsTreeDataProvider.ts index 63e36f7..5ca4400 100644 --- a/src/views/workflows/workflowsTreeDataProvider.ts +++ b/src/views/workflows/workflowsTreeDataProvider.ts @@ -77,18 +77,7 @@ export default class WorkflowsTreeDataProvider ); await window.showTextDocument(document); } catch (error: any) { - try { - await workspace.fs.stat(workflowTreeItem.workflow.uri); - window.showErrorMessage( - `Failed to open workflow. Error: ${error}` - ); - } catch (error: any) { - window.showErrorMessage( - `Workflow ${ - path.parse(workflowTreeItem.workflow.uri.fsPath).base - } not found.` - ); - } + // Silently handle workflow opening errors } } ), @@ -138,13 +127,7 @@ export default class WorkflowsTreeDataProvider } if (errorMessage) { - window - .showErrorMessage(errorMessage, "View Workflows") - .then(async (value) => { - if (value === "View Workflows") { - await commands.executeCommand("workflows.focus"); - } - }); + // Silently handle workflow execution errors } } } @@ -168,9 +151,7 @@ export default class WorkflowsTreeDataProvider ); if (registeredEventsOnWorkflow.length === 0) { - window.showErrorMessage( - `No events registered on the workflow (${workflowTreeItem.workflow.name}). Add an event to the \`on\` section of the workflow to trigger it.` - ); + // Silently handle no events case return; } @@ -197,9 +178,7 @@ export default class WorkflowsTreeDataProvider ); if (registeredEventsOnJobParentWorkflow.length === 0) { - window.showErrorMessage( - `No events registered on the workflow (${jobTreeItem.workflow.name}). Add an event to the \`on\` section of the workflow to trigger it.` - ); + // Silently handle no events case return; }