More actionable notification on plugin download failure

Summary: More actionable notification on plugin download failure.

Reviewed By: priteshrnandgaonkar

Differential Revision: D28856728

fbshipit-source-id: bd4a41af8812168949d83e2e0923ca7976485fa7
This commit is contained in:
Anton Nikolaev
2021-06-03 08:35:37 -07:00
committed by Facebook GitHub Bot
parent fa74502a8a
commit cc4bc293c6
2 changed files with 22 additions and 10 deletions

View File

@@ -116,7 +116,7 @@ async function handlePluginDownload(
});
if (response.headers['content-type'] !== 'application/octet-stream') {
throw new Error(
`Unexpected content type ${response.headers['content-type']} received from ${plugin.downloadUrl}`,
`It looks like you are not on VPN/Lighthouse. Unexpected content type received: ${response.headers['content-type']}.`,
);
}
const responseStream = response.data as fs.ReadStream;
@@ -149,6 +149,7 @@ async function handlePluginDownload(
if (startedByUser) {
showErrorNotification(
`Failed to download plugin "${title}" v${version}.`,
'Please check that you are on VPN/Lighthouse.',
);
}
throw error;