From d20b28e408812b379977bc719cb531754fa0a4ce Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Tue, 14 Nov 2017 19:23:25 -0800 Subject: [PATCH] Remove noise from errmsg for Go To Definition feature #1336 --- src/goDeclaration.ts | 8 ++++---- src/goReferences.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/goDeclaration.ts b/src/goDeclaration.ts index 32266b938..abaccc394 100644 --- a/src/goDeclaration.ts +++ b/src/goDeclaration.ts @@ -67,7 +67,7 @@ function definitionLocation_godef(document: vscode.TextDocument, position: vscod return reject(missingToolMsg + 'godef'); } if (err) { - return reject(err); + return reject(err.message || stderr); }; let result = stdout.toString(); let lines = result.split('\n'); @@ -147,7 +147,7 @@ function definitionLocation_gogetdoc(document: vscode.TextDocument, position: vs return definitionLocation_gogetdoc(document, position, offset, env, false, token); } if (err) { - return reject(err); + return reject(err.message || stderr); }; let goGetDocOutput = JSON.parse(stdout.toString()); let match = /(.*):(\d+):(\d+)/.exec(goGetDocOutput.pos); @@ -193,7 +193,7 @@ function definitionLocation_guru(document: vscode.TextDocument, position: vscode return reject(missingToolMsg + 'guru'); } if (err) { - return reject(err); + return reject(err.message || stderr); }; let guruOutput = JSON.parse(stdout.toString()); let match = /(.*):(\d+):(\d+)/.exec(guruOutput.objpos); @@ -243,7 +243,7 @@ export class GoDefinitionProvider implements vscode.DefinitionProvider { if (typeof err === 'string' && err.startsWith(missingToolMsg)) { promptForMissingTool(err.substr(missingToolMsg.length)); } else { - console.log(err); + return Promise.reject(err); } } return Promise.resolve(null); diff --git a/src/goReferences.ts b/src/goReferences.ts index a9c7d6658..25aeb370a 100644 --- a/src/goReferences.ts +++ b/src/goReferences.ts @@ -41,7 +41,7 @@ export class GoReferenceProvider implements vscode.ReferenceProvider { try { if (err && (err).code === 'ENOENT') { promptForMissingTool('guru'); - return reject('Cannot find tool "guru" to find references.') + return reject('Cannot find tool "guru" to find references.'); } if (err && (err).killed !== true) {