diff --git a/app/server/utils/errors.ts b/app/server/utils/errors.ts index 3aefd1c1..22379a36 100644 --- a/app/server/utils/errors.ts +++ b/app/server/utils/errors.ts @@ -26,7 +26,6 @@ const resticErrorCodes: Record = { 11: "Failed to lock repository: Unable to acquire a lock on the repository. Try to run doctor on the repository.", 12: "Wrong repository password: The provided password for the repository is incorrect.", 130: "Backup interrupted: The backup process was interrupted.", - 999: "The backup was stopped by the user.", }; export class ResticError extends Error { diff --git a/app/server/utils/restic.ts b/app/server/utils/restic.ts index 024edb69..6fdcac4e 100644 --- a/app/server/utils/restic.ts +++ b/app/server/utils/restic.ts @@ -337,6 +337,11 @@ const backup = async ( }, }); + if (options?.signal?.aborted) { + logger.warn("Restic backup was aborted by signal."); + return { result: null, exitCode: res.exitCode }; + } + if (res.exitCode === 3) { logger.error(`Restic backup encountered read errors: ${res.stderr.toString()}`); } @@ -345,11 +350,6 @@ const backup = async ( logger.error(`Restic backup failed: ${res.stderr.toString()}`); logger.error(`Command executed: restic ${args.join(" ")}`); - if (options?.signal?.aborted) { - logger.error("Restic backup was aborted by signal."); - throw new ResticError(999, "Backup operation stopped by user."); - } - throw new ResticError(res.exitCode, res.stderr.toString()); }