mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-04 07:15:54 +01:00
Git - 💄 better error handling and clean-up logging (#219975)
This commit is contained in:
@@ -22,7 +22,7 @@ export class GitProtocolHandler implements UriHandler {
|
||||
}
|
||||
|
||||
handleUri(uri: Uri): void {
|
||||
this.logger.info(`GitProtocolHandler.handleUri(${uri.toString()})`);
|
||||
this.logger.info(`[GitProtocolHandler] handleUri(${uri.toString()})`);
|
||||
|
||||
switch (uri.path) {
|
||||
case '/clone': this.clone(uri);
|
||||
@@ -34,17 +34,17 @@ export class GitProtocolHandler implements UriHandler {
|
||||
const ref = data.ref;
|
||||
|
||||
if (!data.url) {
|
||||
this.logger.warn('Failed to open URI:' + uri.toString());
|
||||
this.logger.warn('[GitProtocolHandler] Failed to open URI:' + uri.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (Array.isArray(data.url) && data.url.length === 0) {
|
||||
this.logger.warn('Failed to open URI:' + uri.toString());
|
||||
this.logger.warn('[GitProtocolHandler] Failed to open URI:' + uri.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (ref !== undefined && typeof ref !== 'string') {
|
||||
this.logger.warn('Failed to open URI due to multiple references:' + uri.toString());
|
||||
this.logger.warn('[GitProtocolHandler] Failed to open URI due to multiple references:' + uri.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ export class GitProtocolHandler implements UriHandler {
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
this.logger.warn('Invalid URI:' + uri.toString());
|
||||
this.logger.warn('[GitProtocolHandler] Invalid URI:' + uri.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(await commands.getCommands(true)).includes('git.clone')) {
|
||||
this.logger.error('Could not complete git clone operation as git installation was not found.');
|
||||
this.logger.error('[GitProtocolHandler] Could not complete git clone operation as git installation was not found.');
|
||||
|
||||
const errorMessage = l10n.t('Could not clone your repository as Git is not installed.');
|
||||
const downloadGit = l10n.t('Download Git');
|
||||
@@ -86,7 +86,7 @@ export class GitProtocolHandler implements UriHandler {
|
||||
return;
|
||||
} else {
|
||||
const cloneTarget = cloneUri.toString(true);
|
||||
this.logger.info(`Executing git.clone for ${cloneTarget}`);
|
||||
this.logger.info(`[GitProtocolHandler] Executing git.clone for ${cloneTarget}`);
|
||||
commands.executeCommand('git.clone', cloneTarget, undefined, { ref: ref });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user