refactor: update cancel download confirmation text and enhance error handling in JsHttpDownloader

This commit is contained in:
Moyasee
2026-01-10 19:47:55 +02:00
parent 562e30eecf
commit da0ae54b60
4 changed files with 13 additions and 6 deletions

View File

@@ -404,9 +404,10 @@
"completed": "Completed", "completed": "Completed",
"removed": "Not downloaded", "removed": "Not downloaded",
"cancel": "Cancel", "cancel": "Cancel",
"cancel_download": "Cancel download", "cancel_download": "Cancel download?",
"cancel_download_description": "Are you sure you want to cancel this download? This will delete all downloaded files.", "cancel_download_description": "Are you sure you want to cancel this download? All downloaded files will be deleted.",
"keep_downloading": "Keep downloading", "keep_downloading": "No, keep downloading",
"yes_cancel": "Yes, cancel",
"filter": "Filter downloaded games", "filter": "Filter downloaded games",
"remove": "Remove", "remove": "Remove",
"downloading_metadata": "Downloading metadata…", "downloading_metadata": "Downloading metadata…",

View File

@@ -258,7 +258,11 @@ export class JsHttpDownloader {
} }
private handleDownloadError(err: Error): void { private handleDownloadError(err: Error): void {
if (err.name === "AbortError") { // Handle abort/cancellation errors - these are expected when user pauses/cancels
if (
err.name === "AbortError" ||
(err as NodeJS.ErrnoException).code === "ERR_STREAM_PREMATURE_CLOSE"
) {
logger.log("[JsHttpDownloader] Download aborted"); logger.log("[JsHttpDownloader] Download aborted");
this.status = "paused"; this.status = "paused";
} else { } else {

View File

@@ -844,7 +844,7 @@ export function DownloadGroup({
visible={cancelModalVisible} visible={cancelModalVisible}
title={t("cancel_download")} title={t("cancel_download")}
descriptionText={t("cancel_download_description")} descriptionText={t("cancel_download_description")}
confirmButtonLabel={t("cancel")} confirmButtonLabel={t("yes_cancel")}
cancelButtonLabel={t("keep_downloading")} cancelButtonLabel={t("keep_downloading")}
onConfirm={handleConfirmCancel} onConfirm={handleConfirmCancel}
onClose={handleCancelModalClose} onClose={handleCancelModalClose}
@@ -877,7 +877,7 @@ export function DownloadGroup({
visible={cancelModalVisible} visible={cancelModalVisible}
title={t("cancel_download")} title={t("cancel_download")}
descriptionText={t("cancel_download_description")} descriptionText={t("cancel_download_description")}
confirmButtonLabel={t("cancel")} confirmButtonLabel={t("yes_cancel")}
cancelButtonLabel={t("keep_downloading")} cancelButtonLabel={t("keep_downloading")}
onConfirm={handleConfirmCancel} onConfirm={handleConfirmCancel}
onClose={handleCancelModalClose} onClose={handleCancelModalClose}

View File

@@ -91,6 +91,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: globals.$spacing-unit; gap: globals.$spacing-unit;
padding-bottom: calc(globals.$spacing-unit * 3);
} }
&__empty { &__empty {
@@ -134,5 +135,6 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
padding: calc(globals.$spacing-unit * 2); padding: calc(globals.$spacing-unit * 2);
padding-bottom: calc(globals.$spacing-unit * 3);
} }
} }