Skip to content

Commit

Permalink
Improve error logging for invalid plugin metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kmturley committed Jun 5, 2024
1 parent 3200876 commit 0812ea6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sources/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ async function githubGetRelease(pluginPack: PluginPack, repo: GitHubRepository,
const pluginsJsonList = await getJSONSafe(
`https://github.com/${repo.nameWithOwner}/releases/download/${release.tagName}/plugins.json`,
);
if (!pluginsJsonList.plugins)
return console.log(
`FetchError: invalid json response body at https://github.com/${repo.nameWithOwner}/releases/download/${release.tagName}/plugins.json`,
);
pluginsJsonList.plugins.forEach((plugin: PluginVersion) => {
// For each plugin sanitize the id and add to registry
const pluginId: string = safeSlug(`${repo.nameWithOwner}/${plugin.id}`);
Expand Down Expand Up @@ -123,8 +127,7 @@ async function getJSONSafe(url: string): Promise<any> {
const json = await response.json();
return json;
} catch (error) {
// console.log(error);
return { plugins: [] };
return error;
}
}

Expand Down

0 comments on commit 0812ea6

Please sign in to comment.