Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #1202. Lenient error handling for Yarn output. Check if out… #1425

Merged
merged 2 commits into from
Apr 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions packages/insomnia-app/app/plugins/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ async function _isInsomniaPlugin(lookupName: string): Promise<Object> {
},
},
(err, stdout, stderr) => {
if (err) {
reject(new Error(`${lookupName} npm error: ${err.message}`));
return;
}

if (stderr) {
reject(new Error(`Yarn error ${stderr.toString('utf8')}`));
return;
Expand All @@ -91,8 +86,12 @@ async function _isInsomniaPlugin(lookupName: string): Promise<Object> {
let yarnOutput;
try {
yarnOutput = JSON.parse(stdout.toString('utf8'));
} catch (err) {
reject(new Error(`Yarn response not JSON: ${err.message}`));
} catch (ex) {
if (err) {
reject(new Error(`${lookupName} npm error: ${err.message}`));
} else {
reject(new Error(`Yarn response not JSON: ${ex.message}`));
}
return;
}

Expand Down Expand Up @@ -149,7 +148,7 @@ async function _installPluginToTmpDir(lookupName: string): Promise<{ tmpDir: str
},
},
(err, stdout, stderr) => {
if (err) {
if (err && !stdout.toString('utf8').includes('success')) {
reject(new Error(`${lookupName} install error: ${err.message}`));
return;
}
Expand Down