Skip to content

Commit

Permalink
Improve error messaging for plugin downloads
Browse files Browse the repository at this point in the history
Summary:
This will only show and raise an error if no further download URLs are available. Otherwise,
cases where another download URL is still available will look as if the download failed fatally.

Reviewed By: antonk52

Differential Revision: D54984433

fbshipit-source-id: 15b02de6a573ff7dd1d53486f68efe9828a30a8f
  • Loading branch information
passy authored and facebook-github-bot committed Mar 18, 2024
1 parent 8219d40 commit d7db215
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions desktop/flipper-server/src/plugins/PluginManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class PluginManager {
tmpDir,
`${getPluginDirNameFromPackageName(name)}-${version}.tgz`,
);
let finalError = null;
let finalError: Error | null = null;
for (const downloadUrl of downloadUrls) {
try {
const cancelationSource = axios.CancelToken.source();
Expand Down Expand Up @@ -184,17 +184,17 @@ export class PluginManager {
return await installPluginFromFileOrBuffer(tmpFile);
}
} catch (error) {
console.warn(
`Failed to download plugin "${title}" v${version} from "${downloadUrl}" to "${installationDir}".`,
error,
);
finalError = error;
continue;
} finally {
await fs.remove(tmpDir);
}
}

console.info(
`Failed to download plugin "${title}" v${version} from "${downloadUrls}" to "${installationDir}".`,
finalError,
);
throw finalError;
}

Expand Down

0 comments on commit d7db215

Please sign in to comment.