Compare commits

...

1 Commits

9 changed files with 40 additions and 129 deletions

View File

@@ -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;
}

View File

@@ -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
}
}
});

View File

@@ -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<string | undefined>((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());

View File

@@ -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
}
}

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -35,11 +35,8 @@ export default class HistoryTreeDataProvider implements TreeDataProvider<GithubL
}
}
window.showErrorMessage(`${historyTreeItem.history.name} #${historyTreeItem.history.count} task is no longer open.`, 'View Output').then(async value => {
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);

View File

@@ -254,12 +254,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
const document = await workspace.openTextDocument(settingFileTreeItem.settingFile.path);
await window.showTextDocument(document);
} catch (error: any) {
try {
await workspace.fs.stat(Uri.file(settingFileTreeItem.settingFile.path));
window.showErrorMessage(`Failed to open file. Error: ${error}`);
} catch (error: any) {
window.showErrorMessage(`File ${settingFileTreeItem.settingFile.name} not found.`);
}
// Silently handle file opening errors
}
}),
commands.registerCommand('githubLocalActions.removeCustomSetting', async (customTreeItem: SettingFileTreeItem | OptionTreeItem) => {
@@ -352,7 +347,7 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
});
if (errors.length > 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<Github
});
if (hasDuplicates) {
window.showErrorMessage('Duplicate variables selected');
// Silently handle duplicate variables
} else {
for await (const variable of selectedVariables) {
const newSetting = settings.variables.find(existingVariable => existingVariable.key === variable.label);
@@ -384,11 +379,11 @@ export default class SettingsTreeDataProvider implements TreeDataProvider<Github
}
}
} else if (errors.length === 0) {
window.showErrorMessage('No matching variables defined in Github');
// Silently handle no matching variables
}
}
} else {
window.showErrorMessage('No variables found in workflow(s)');
// Silently handle no variables found
}
}),
commands.registerCommand('githubLocalActions.editSetting', async (settingTreeItem: SettingTreeItem) => {

View File

@@ -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;
}