Skip to content

Commit

Permalink
Add suggestion to error message caused by long file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
anttimaki committed Nov 4, 2024
1 parent 26510e4 commit af34405
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/views/DownloadModModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ let assignId = 0;
const existing = DownloadModModal.allVersions[assignIndex]
existing[1].failed = true;
DownloadModModal.allVersions[assignIndex] = [currentAssignId, existing[1]];
DownloadModModal.addCdnSolutionToError(err);
DownloadModModal.addSolutionsToError(err);
return reject(err);
}
} else if (status === StatusEnum.PENDING) {
Expand Down Expand Up @@ -306,7 +306,7 @@ let assignId = 0;
const existing = DownloadModModal.allVersions[assignIndex]
existing[1].failed = true;
this.$set(DownloadModModal.allVersions, assignIndex, [currentAssignId, existing[1]]);
DownloadModModal.addCdnSolutionToError(err);
DownloadModModal.addSolutionsToError(err);
this.$store.commit('error/handleError', err);
return;
}
Expand Down Expand Up @@ -348,7 +348,7 @@ let assignId = 0;
const existing = DownloadModModal.allVersions[assignIndex]
existing[1].failed = true;
this.$set(DownloadModModal.allVersions, assignIndex, [currentAssignId, existing[1]]);
DownloadModModal.addCdnSolutionToError(err);
DownloadModModal.addSolutionsToError(err);
this.$store.commit('error/handleError', err);
return;
}
Expand Down Expand Up @@ -432,13 +432,22 @@ let assignId = 0;
});
}
static addCdnSolutionToError(err: R2Error): void {
static addSolutionsToError(err: R2Error): void {
// Sanity check typing.
if (!(err instanceof R2Error)) {
return;
}
if (
err.name.includes("Failed to download mod") ||
err.name.includes("System.Net.WebException")
) {
err.solution = "Try toggling the preferred Thunderstore CDN in the settings";
}
if (err.message.includes("System.IO.PathTooLongException")) {
err.solution = 'Using "Change data folder" option in the settings to select a shorter path might solve the issue';
}
}
}
Expand Down

0 comments on commit af34405

Please sign in to comment.