Bladeren bron

Consolidates error messaging to show output channel button

main
Eric Amodio 6 jaren geleden
bovenliggende
commit
f01a8b7430
33 gewijzigde bestanden met toevoegingen van 91 en 45 verwijderingen
  1. +2
    -1
      src/commands/clearFileAnnotations.ts
  2. +2
    -1
      src/commands/closeUnchangedFiles.ts
  3. +3
    -2
      src/commands/copyMessageToClipboard.ts
  4. +3
    -2
      src/commands/copyShaToClipboard.ts
  5. +3
    -2
      src/commands/diffBranchWithBranch.ts
  6. +2
    -1
      src/commands/diffDirectory.ts
  7. +1
    -1
      src/commands/diffLineWithPrevious.ts
  8. +1
    -1
      src/commands/diffLineWithWorking.ts
  9. +3
    -2
      src/commands/diffWith.ts
  10. +1
    -1
      src/commands/diffWithNext.ts
  11. +1
    -1
      src/commands/diffWithPrevious.ts
  12. +1
    -1
      src/commands/diffWithRevision.ts
  13. +1
    -1
      src/commands/diffWithWorking.ts
  14. +2
    -1
      src/commands/externalDiff.ts
  15. +2
    -1
      src/commands/openChangedFiles.ts
  16. +1
    -1
      src/commands/openFileRevision.ts
  17. +3
    -2
      src/commands/openInRemote.ts
  18. +3
    -2
      src/commands/openWorkingFile.ts
  19. +2
    -1
      src/commands/showCommitSearch.ts
  20. +3
    -2
      src/commands/showLastQuickPick.ts
  21. +2
    -1
      src/commands/showQuickBranchHistory.ts
  22. +2
    -2
      src/commands/showQuickCommitDetails.ts
  23. +1
    -1
      src/commands/showQuickCommitFileDetails.ts
  24. +3
    -2
      src/commands/showQuickCurrentBranchHistory.ts
  25. +1
    -1
      src/commands/showQuickFileHistory.ts
  26. +2
    -1
      src/commands/showQuickRepoStatus.ts
  27. +2
    -1
      src/commands/showQuickStashList.ts
  28. +2
    -1
      src/commands/stashApply.ts
  29. +2
    -1
      src/commands/stashDelete.ts
  30. +2
    -1
      src/commands/stashSave.ts
  31. +2
    -1
      src/git/remotes/provider.ts
  32. +6
    -0
      src/logger.ts
  33. +24
    -5
      src/messages.ts

+ 2
- 1
src/commands/clearFileAnnotations.ts Bestand weergeven

@ -3,6 +3,7 @@ import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { UriComparer } from '../comparers';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Commands, EditorCommand } from './common';
export class ClearFileAnnotationsCommand extends EditorCommand {
@ -26,7 +27,7 @@ export class ClearFileAnnotationsCommand extends EditorCommand {
}
catch (ex) {
Logger.error(ex, 'ClearFileAnnotationsCommand');
return window.showErrorMessage(`Unable to clear file annotations. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to clear file annotations');
}
}
}

+ 2
- 1
src/commands/closeUnchangedFiles.ts Bestand weergeven

@ -4,6 +4,7 @@ import { TextEditorComparer, UriComparer } from '../comparers';
import { BuiltInCommands, GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { ActiveEditorTracker } from '../trackers/activeEditorTracker';
import { ActiveEditorCommand, Commands, getCommandUri, getRepoPathOrActiveOrPrompt } from './common';
@ -86,7 +87,7 @@ export class CloseUnchangedFilesCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'CloseUnchangedFilesCommand');
return window.showErrorMessage(`Unable to close unchanged files. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to close unchanged files');
}
}
}

+ 3
- 2
src/commands/copyMessageToClipboard.ts Bestand weergeven

@ -4,6 +4,7 @@ import { TextEditor, Uri, window } from 'vscode';
import { Container } from '../container';
import { GitUri } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Iterables } from '../system';
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
@ -70,7 +71,7 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'CopyMessageToClipboardCommand', `getBlameForLine(${blameline})`);
return window.showErrorMessage(`Unable to copy message. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to copy message');
}
}
@ -93,7 +94,7 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
}
Logger.error(ex, 'CopyMessageToClipboardCommand');
return window.showErrorMessage(`Unable to copy message. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to copy message');
}
}
}

+ 3
- 2
src/commands/copyShaToClipboard.ts Bestand weergeven

@ -4,6 +4,7 @@ import { TextEditor, Uri, window } from 'vscode';
import { Container } from '../container';
import { GitUri } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Iterables } from '../system';
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
@ -58,7 +59,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'CopyShaToClipboardCommand', `getBlameForLine(${blameline})`);
return window.showErrorMessage(`Unable to copy commit id. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to copy ommit id');
}
}
@ -74,7 +75,7 @@ export class CopyShaToClipboardCommand extends ActiveEditorCommand {
}
Logger.error(ex, 'CopyShaToClipboardCommand');
return window.showErrorMessage(`Unable to copy commit id. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to copy ommit id');
}
}
}

+ 3
- 2
src/commands/diffBranchWithBranch.ts Bestand weergeven

@ -1,8 +1,9 @@
'use strict';
import { CancellationTokenSource, TextEditor, Uri, window } from 'vscode';
import { CancellationTokenSource, TextEditor, Uri } from 'vscode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../quickpicks';
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, getRepoPathOrActiveOrPrompt } from './common';
@ -85,7 +86,7 @@ export class DiffBranchWithBranchCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'DiffBranchWithBranchCommand');
return window.showErrorMessage(`Unable to open branch compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open branch compare');
}
finally {
progressCancellation && progressCancellation.cancel();

+ 2
- 1
src/commands/diffDirectory.ts Bestand weergeven

@ -3,6 +3,7 @@ import { CancellationTokenSource, commands, TextEditor, Uri, window } from 'vsco
import { BuiltInCommands, GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { BranchesAndTagsQuickPick, CommandQuickPickItem } from '../quickpicks';
import { ComparisonResultsNode } from '../views/nodes';
import {
@ -111,7 +112,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
}
Logger.error(ex, 'DiffDirectoryCommand');
return window.showErrorMessage(`Unable to open directory compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open directory compare');
}
finally {
progressCancellation && progressCancellation.cancel();

+ 1
- 1
src/commands/diffLineWithPrevious.ts Bestand weergeven

@ -57,7 +57,7 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'DiffLineWithPreviousCommand', `getBlameForLine(${blameline})`);
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open compare');
}
}

+ 1
- 1
src/commands/diffLineWithWorking.ts Bestand weergeven

@ -63,7 +63,7 @@ export class DiffLineWithWorkingCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'DiffLineWithWorkingCommand', `getBlameForLine(${blameline})`);
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open compare');
}
}

+ 3
- 2
src/commands/diffWith.ts Bestand weergeven

@ -1,10 +1,11 @@
'use strict';
import * as path from 'path';
import { commands, Range, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window } from 'vscode';
import { commands, Range, TextDocumentShowOptions, TextEditor, Uri, ViewColumn } from 'vscode';
import { BuiltInCommands, GlyphChars } from '../constants';
import { Container } from '../container';
import { GitCommit, GitService, GitUri } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { ActiveEditorCommand, Commands } from './common';
export interface DiffWithCommandArgsRevision {
@ -174,7 +175,7 @@ export class DiffWithCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'DiffWithCommand', 'getVersionedFile');
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open compare');
}
}
}

+ 1
- 1
src/commands/diffWithNext.ts Bestand weergeven

@ -84,7 +84,7 @@ export class DiffWithNextCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'DiffWithNextCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`);
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open compare');
}
}

+ 1
- 1
src/commands/diffWithPrevious.ts Bestand weergeven

@ -145,7 +145,7 @@ export class DiffWithPreviousCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'DiffWithPreviousCommand', `getLogForFile(${gitUri.repoPath}, ${gitUri.fsPath})`);
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open compare');
}
}

+ 1
- 1
src/commands/diffWithRevision.ts Bestand weergeven

@ -156,7 +156,7 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'DiffWithRevisionCommand');
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open compare');
}
finally {
progressCancellation.cancel();

+ 1
- 1
src/commands/diffWithWorking.ts Bestand weergeven

@ -73,7 +73,7 @@ export class DiffWithWorkingCommand extends ActiveEditorCommand {
'DiffWithWorkingCommand',
`getLogCommit(${gitUri.repoPath}, ${gitUri.fsPath}, ${gitUri.sha})`
);
return window.showErrorMessage(`Unable to open compare. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open compare');
}
}

+ 2
- 1
src/commands/externalDiff.ts Bestand weergeven

@ -3,6 +3,7 @@ import { commands, SourceControlResourceState, Uri, window } from 'vscode';
import { BuiltInCommands, GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Arrays } from '../system';
import { Command, CommandContext, Commands, getRepoPathOrActiveOrPrompt } from './common';
@ -135,7 +136,7 @@ export class ExternalDiffCommand extends Command {
}
catch (ex) {
Logger.error(ex, 'ExternalDiffCommand');
return window.showErrorMessage(`Unable to open changes in diff tool. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open changes in diff tool');
}
}
}

+ 2
- 1
src/commands/openChangedFiles.ts Bestand weergeven

@ -3,6 +3,7 @@ import { TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Arrays } from '../system';
import { ActiveEditorCommand, Commands, getCommandUri, getRepoPathOrActiveOrPrompt, openEditor } from './common';
@ -43,7 +44,7 @@ export class OpenChangedFilesCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'OpenChangedFilesCommand');
return window.showErrorMessage(`Unable to open changed files. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open changed files');
}
}
}

+ 1
- 1
src/commands/openFileRevision.ts Bestand weergeven

@ -182,7 +182,7 @@ export class OpenFileRevisionCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'OpenFileRevisionCommand');
return window.showErrorMessage(`Unable to open file revision. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open file revision');
}
finally {
progressCancellation && progressCancellation.cancel();

+ 3
- 2
src/commands/openInRemote.ts Bestand weergeven

@ -1,8 +1,9 @@
'use strict';
import { TextEditor, Uri, window } from 'vscode';
import { TextEditor, Uri } from 'vscode';
import { GlyphChars } from '../constants';
import { GitLogCommit, GitRemote, GitService, RemoteResource, RemoteResourceType } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickpicks';
import { Strings } from '../system';
import { ActiveEditorCommand, Commands } from './common';
@ -96,7 +97,7 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'OpenInRemoteCommand');
return window.showErrorMessage(`Unable to open in remote provider. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open in remote provider');
}
}

+ 3
- 2
src/commands/openWorkingFile.ts Bestand weergeven

@ -1,10 +1,11 @@
'use strict';
import * as path from 'path';
import { Range, TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
import { Range, TextDocumentShowOptions, TextEditor, Uri } from 'vscode';
import { FileAnnotationType } from '../configuration';
import { Container } from '../container';
import { GitUri } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { ActiveEditorCommand, Commands, getCommandUri, openEditor } from './common';
export interface OpenWorkingFileCommandArgs {
@ -56,7 +57,7 @@ export class OpenWorkingFileCommand extends ActiveEditorCommand {
}
catch (ex) {
Logger.error(ex, 'OpenWorkingFileCommand');
return window.showErrorMessage(`Unable to open working file. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to open working file');
}
}
}

+ 2
- 1
src/commands/showCommitSearch.ts Bestand weergeven

@ -4,6 +4,7 @@ import { GlyphChars } from '../constants';
import { Container } from '../container';
import { GitRepoSearchBy, GitService, GitUri } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem, CommitsQuickPick, ShowCommitsSearchInResultsQuickPickItem } from '../quickpicks';
import { Strings } from '../system';
import { Iterables } from '../system/iterable';
@ -183,7 +184,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
}
catch (ex) {
Logger.error(ex, 'ShowCommitSearchCommand');
return window.showErrorMessage(`Unable to find commits. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to find commits');
}
finally {
progressCancellation.cancel();

+ 3
- 2
src/commands/showLastQuickPick.ts Bestand weergeven

@ -1,6 +1,7 @@
'use strict';
import { commands, window } from 'vscode';
import { commands } from 'vscode';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { Command, Commands, getLastCommand } from './common';
export class ShowLastQuickPickCommand extends Command {
@ -17,7 +18,7 @@ export class ShowLastQuickPickCommand extends Command {
}
catch (ex) {
Logger.error(ex, 'ShowLastQuickPickCommand');
return window.showErrorMessage(`Unable to show last quick pick. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show last quick pick');
}
}
}

+ 2
- 1
src/commands/showQuickBranchHistory.ts Bestand weergeven

@ -4,6 +4,7 @@ import { GlyphChars } from '../constants';
import { Container } from '../container';
import { GitLog, GitUri } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { BranchesQuickPick, BranchHistoryQuickPick, CommandQuickPickItem } from '../quickpicks';
import { Strings } from '../system';
import { ActiveEditorCachedCommand, Commands, getCommandUri, getRepoPathOrActiveOrPrompt } from './common';
@ -116,7 +117,7 @@ export class ShowQuickBranchHistoryCommand extends ActiveEditorCachedCommand {
}
catch (ex) {
Logger.error(ex, 'ShowQuickBranchHistoryCommand');
return window.showErrorMessage(`Unable to show branch history. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show branch history');
}
finally {
progressCancellation && progressCancellation.cancel();

+ 2
- 2
src/commands/showQuickCommitDetails.ts Bestand weergeven

@ -87,7 +87,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
}
catch (ex) {
Logger.error(ex, 'ShowQuickCommitDetailsCommand', `getBlameForLine(${blameline})`);
return window.showErrorMessage(`Unable to show commit details. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show commit details');
}
}
@ -165,7 +165,7 @@ export class ShowQuickCommitDetailsCommand extends ActiveEditorCachedCommand {
}
catch (ex) {
Logger.error(ex, 'ShowQuickCommitDetailsCommand');
return window.showErrorMessage(`Unable to show commit details. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show commit details');
}
}
}

+ 1
- 1
src/commands/showQuickCommitFileDetails.ts Bestand weergeven

@ -179,7 +179,7 @@ export class ShowQuickCommitFileDetailsCommand extends ActiveEditorCachedCommand
}
catch (ex) {
Logger.error(ex, 'ShowQuickCommitFileDetailsCommand');
return window.showErrorMessage(`Unable to show commit file details. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show commit file details');
}
}
}

+ 3
- 2
src/commands/showQuickCurrentBranchHistory.ts Bestand weergeven

@ -1,8 +1,9 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { commands, TextEditor, Uri } from 'vscode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem } from '../quickpicks';
import { ActiveEditorCachedCommand, Commands, getCommandUri, getRepoPathOrActiveOrPrompt } from './common';
import { ShowQuickBranchHistoryCommandArgs } from './showQuickBranchHistory';
@ -38,7 +39,7 @@ export class ShowQuickCurrentBranchHistoryCommand extends ActiveEditorCachedComm
}
catch (ex) {
Logger.error(ex, 'ShowQuickCurrentBranchHistoryCommand');
return window.showErrorMessage(`Unable to show branch history. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show branch history');
}
}
}

+ 1
- 1
src/commands/showQuickFileHistory.ts Bestand weergeven

@ -163,7 +163,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
}
catch (ex) {
Logger.error(ex, 'ShowQuickFileHistoryCommand');
return window.showErrorMessage(`Unable to show file history. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show file history');
}
finally {
progressCancellation.cancel();

+ 2
- 1
src/commands/showQuickRepoStatus.ts Bestand weergeven

@ -3,6 +3,7 @@ import { TextEditor, Uri, window } from 'vscode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem, RepoStatusQuickPick } from '../quickpicks';
import { ActiveEditorCachedCommand, Commands, getCommandUri, getRepoPathOrActiveOrPrompt } from './common';
@ -38,7 +39,7 @@ export class ShowQuickRepoStatusCommand extends ActiveEditorCachedCommand {
}
catch (ex) {
Logger.error(ex, 'ShowQuickRepoStatusCommand');
return window.showErrorMessage(`Unable to show repository status. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show repository status');
}
}
}

+ 2
- 1
src/commands/showQuickStashList.ts Bestand weergeven

@ -3,6 +3,7 @@ import { commands, TextEditor, Uri, window } from 'vscode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem, StashListQuickPick } from '../quickpicks';
import { Strings } from '../system';
import { ActiveEditorCachedCommand, Commands, getCommandUri, getRepoPathOrActiveOrPrompt } from './common';
@ -69,7 +70,7 @@ export class ShowQuickStashListCommand extends ActiveEditorCachedCommand {
}
catch (ex) {
Logger.error(ex, 'ShowQuickStashListCommand');
return window.showErrorMessage(`Unable to show stashed changes. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to show stashed changes');
}
finally {
progressCancellation.cancel();

+ 2
- 1
src/commands/stashApply.ts Bestand weergeven

@ -4,6 +4,7 @@ import { GlyphChars } from '../constants';
import { Container } from '../container';
import { GitStashCommit } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem, RepositoriesQuickPick, StashListQuickPick } from '../quickpicks';
import { Strings } from '../system';
import { Command, CommandContext, Commands, isCommandViewContextWithCommit } from './common';
@ -132,7 +133,7 @@ export class StashApplyCommand extends Command {
return window.showInformationMessage(`Stash applied with conflicts`);
}
else {
return window.showErrorMessage(`Unable to apply stash. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to apply stash');
}
}
}

+ 2
- 1
src/commands/stashDelete.ts Bestand weergeven

@ -4,6 +4,7 @@ import { GlyphChars } from '../constants';
import { Container } from '../container';
import { GitStashCommit } from '../git/gitService';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem } from '../quickpicks';
import { Command, CommandContext, Commands, isCommandViewContextWithCommit } from './common';
@ -63,7 +64,7 @@ export class StashDeleteCommand extends Command {
}
catch (ex) {
Logger.error(ex, 'StashDeleteCommand');
return window.showErrorMessage(`Unable to delete stash. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to delete stash');
}
}
}

+ 2
- 1
src/commands/stashSave.ts Bestand weergeven

@ -3,6 +3,7 @@ import { InputBoxOptions, Uri, window } from 'vscode';
import { GlyphChars } from '../constants';
import { Container } from '../container';
import { Logger } from '../logger';
import { Messages } from '../messages';
import { CommandQuickPickItem, RepositoriesQuickPick } from '../quickpicks';
import { Command, CommandContext, Commands } from './common';
@ -71,7 +72,7 @@ export class StashSaveCommand extends Command {
if (msg.includes('newer version of Git')) {
return window.showErrorMessage(`Unable to save stash. ${msg}`);
}
return window.showErrorMessage(`Unable to save stash. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to save stash');
}
}
}

+ 2
- 1
src/git/remotes/provider.ts Bestand weergeven

@ -3,6 +3,7 @@ import * as clipboard from 'clipboardy';
import { commands, Range, Uri, window } from 'vscode';
import { BuiltInCommands } from '../../constants';
import { Logger } from '../../logger';
import { Messages } from '../../messages';
import { GitLogCommit } from '../models/logCommit';
export enum RemoteResourceType {
@ -132,7 +133,7 @@ export abstract class RemoteProvider {
}
Logger.error(ex, 'CopyRemoteUrlToClipboardCommand');
return window.showErrorMessage(`Unable to copy remote url. See output channel for more details`);
return Messages.showGenericErrorMessage('Unable to copy remote url');
}
}

+ 6
- 0
src/logger.ts Bestand weergeven

@ -83,6 +83,12 @@ export class Logger {
}
}
static showOutputChannel() {
if (this.output !== undefined) {
this.output.show();
}
}
private static get timestamp(): string {
const now = new Date();
const time = now

+ 24
- 5
src/messages.ts Bestand weergeven

@ -40,6 +40,22 @@ export class Messages {
);
}
static async showGenericErrorMessage(message: string): Promise<MessageItem | undefined> {
const actions: MessageItem[] = [{ title: 'Open Output Channel' }];
const result = await Messages.showMessage(
'error',
`${message}. See output channel for more details`,
undefined,
null,
...actions
);
if (result !== undefined) {
Logger.showOutputChannel();
}
return result;
}
static showFileNotUnderSourceControlWarningMessage(message: string): Promise<MessageItem | undefined> {
return Messages.showMessage(
'warn',
@ -121,18 +137,21 @@ export class Messages {
private static async showMessage<T extends MessageItem>(
type: 'info' | 'warn' | 'error',
message: string,
suppressionKey: SuppressedMessages,
suppressionKey?: SuppressedMessages,
dontShowAgain: T | null = { title: "Don't Show Again" } as T,
...actions: T[]
): Promise<T | undefined> {
Logger.log(`ShowMessage(${type}, '${message}', ${suppressionKey}, ${dontShowAgain})`);
if (configuration.get<boolean>(configuration.name('advanced')('messages')(suppressionKey).value)) {
if (
suppressionKey !== undefined &&
configuration.get<boolean>(configuration.name('advanced')('messages')(suppressionKey).value)
) {
Logger.log(`ShowMessage(${type}, '${message}', ${suppressionKey}, ${dontShowAgain}) skipped`);
return undefined;
}
if (dontShowAgain !== null) {
if (suppressionKey !== undefined && dontShowAgain !== null) {
actions.push(dontShowAgain);
}
@ -151,11 +170,11 @@ export class Messages {
break;
}
if (dontShowAgain === null || result === dontShowAgain) {
if ((suppressionKey !== undefined && dontShowAgain === null) || result === dontShowAgain) {
Logger.log(
`ShowMessage(${type}, '${message}', ${suppressionKey}, ${dontShowAgain}) don't show again requested`
);
await this.suppressedMessage(suppressionKey);
await this.suppressedMessage(suppressionKey!);
if (result === dontShowAgain) return undefined;
}

Laden…
Annuleren
Opslaan