From 5cb0053a059535aed0895204b5d788537a03413a Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 17 Nov 2016 01:05:03 -0500 Subject: [PATCH] Fixes incorrect 'Unable to find Git' message --- package.json | 6 +++--- src/extension.ts | 4 +++- src/git/gitLocator.ts | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 9c61513..2fd573e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitlens", - "version": "1.0.1", + "version": "1.0.2", "author": { "name": "Eric Amodio", "email": "eamodio@gmail.com" @@ -369,8 +369,8 @@ "tslint": "^3.15.1", "typescript": "^2.0.9", "vscode": "^1.0.3", - "@types/node": "^6.0.46", - "@types/mocha": "^2.2.32", + "@types/node": "^6.0.48", + "@types/mocha": "^2.2.33", "@types/tmp": "^0.0.31" }, "scripts": { diff --git a/src/extension.ts b/src/extension.ts index 28ed7a0..c565c5b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -38,7 +38,9 @@ export async function activate(context: ExtensionContext) { } catch (ex) { Logger.error(ex); - await window.showErrorMessage(`GitLens: Unable to find Git. Please make sure Git is installed. Also ensure that Git is either in the PATH, or that 'gitlens.advanced.git' is pointed to its installed location.`); + if (ex.message.includes('Unable to find git')) { + await window.showErrorMessage(`GitLens: Unable to find Git. Please make sure Git is installed. Also ensure that Git is either in the PATH, or that 'gitlens.advanced.git' is pointed to its installed location.`); + } return; } diff --git a/src/git/gitLocator.ts b/src/git/gitLocator.ts index ad49c87..0d6d241 100644 --- a/src/git/gitLocator.ts +++ b/src/git/gitLocator.ts @@ -34,18 +34,18 @@ async function findGitDarwin(): Promise { } catch (ex) { if (ex.code === 2) { - return Promise.reject('Unable to find git'); + return Promise.reject(new Error('Unable to find git')); } return findSpecificGit(path); } } catch (ex) { - return Promise.reject('Unable to find git'); + return Promise.reject(new Error('Unable to find git')); } } function findSystemGitWin32(basePath: string): Promise { - if (!basePath) return Promise.reject('Unable to find git'); + if (!basePath) return Promise.reject(new Error('Unable to find git')); return findSpecificGit(path.join(basePath, 'Git', 'cmd', 'git.exe')); } @@ -69,7 +69,7 @@ export async function findGitPath(path?: string): Promise { } } catch (ex) { - return Promise.reject('Unable to find git'); + return Promise.reject(new Error('Unable to find git')); } } } \ No newline at end of file