fix: silence abort warning on cancel
This commit is contained in:
@@ -857,7 +857,7 @@ function htmlPage(): string {
|
|||||||
|
|
||||||
for (const entry of listing) {
|
for (const entry of listing) {
|
||||||
if (controller.signal.aborted) {
|
if (controller.signal.aborted) {
|
||||||
throw new DOMException("Import abgebrochen", "AbortError");
|
throw controller.signal.reason ?? new Error("Import abgebrochen");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -901,7 +901,7 @@ function htmlPage(): string {
|
|||||||
);
|
);
|
||||||
setProgress(listing.length, listing.length, "fertig");
|
setProgress(listing.length, listing.length, "fertig");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof DOMException && error.name === "AbortError") {
|
if (controller.signal.aborted) {
|
||||||
updateStatus("Import abgebrochen.");
|
updateStatus("Import abgebrochen.");
|
||||||
setProgress(state.processed, state.total, "abgebrochen");
|
setProgress(state.processed, state.total, "abgebrochen");
|
||||||
return;
|
return;
|
||||||
@@ -940,7 +940,7 @@ function htmlPage(): string {
|
|||||||
|
|
||||||
cancelShare.addEventListener("click", () => {
|
cancelShare.addEventListener("click", () => {
|
||||||
if (activeImportController) {
|
if (activeImportController) {
|
||||||
activeImportController.abort();
|
activeImportController.abort("Import durch Benutzer abgebrochen");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user