Skip to content

Commit

Permalink
Track error status whwn mod list is partially loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
VilppeRiskidev committed Feb 12, 2025
1 parent e8cc77f commit cc4f6a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/store/modules/TsModsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function isPackageListChunk(value: unknown): value is PackageListChunk {
}

const EXCLUSIONS = 'https://raw.githubusercontent.com/ebkr/r2modmanPlus/master/modExclusions.md';
const PARTIAL_UPDATE_ERROR = 'Failed to fetch and cache some of the packages.';

/**
* For dealing with mods listed in communities, i.e. available through
Expand Down Expand Up @@ -124,6 +125,11 @@ export const TsModsModule = {
&& (Date.now() - state.modsLastUpdated.getTime()) > (1000 * 60 * 60);
},

/*** Is the error from only some of the package chunks failing to be fetched/cached? */
isStatusPartiallyFailed(state) {
return state.thunderstoreModListUpdateError?.message === PARTIAL_UPDATE_ERROR;
},

/*** Return ThunderstoreMod representation of a ManifestV2 */
tsMod: (_state, getters) => (mod: ExportMod|ManifestV2): ThunderstoreMod | undefined => {
return getters.cachedMod(mod).tsMod;
Expand Down Expand Up @@ -283,6 +289,8 @@ export const TsModsModule = {
// hash is updated in the API.
if (successes === chunkCount) {
await dispatch('cacheIndexHash', packageListIndex.hash);
} else {
throw new Error('Failed to fetch and cache some of the packages.');
}

return successes === chunkCount;
Expand Down

0 comments on commit cc4f6a5

Please sign in to comment.