aboutsummaryrefslogtreecommitdiff
path: root/src/modules/update.js
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2024-08-04 23:45:15 +0200
committerJan200101 <sentrycraft123@gmail.com>2024-08-04 23:45:15 +0200
commit5ae62ca65db09112f608892e595334e50b8cd4f7 (patch)
tree2bc3f61acbdf91631217b08a2043030018b1487a /src/modules/update.js
parent2d5e71e77edc00c9378f5a936825f48d8f895fab (diff)
downloadViper-5ae62ca65db09112f608892e595334e50b8cd4f7.tar.gz
Viper-5ae62ca65db09112f608892e595334e50b8cd4f7.zip
feat: add error handler for streaming unzip
Diffstat (limited to 'src/modules/update.js')
-rw-r--r--src/modules/update.js29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/modules/update.js b/src/modules/update.js
index c001ba8..c792217 100644
--- a/src/modules/update.js
+++ b/src/modules/update.js
@@ -401,9 +401,36 @@ update.northstar = async (force_install) => {
console.ok(lang("cli.update.download_done"));
+ let destination = unzip.Extract({path: settings().gamepath});
+
+ // If we receive multiple errors of the same type we ignore them
+ let received_errors = [];
+ destination.on("error", (err) => {
+ if (received_errors.indexOf(err.code) >= 0)
+ return;
+
+ received_errors.push(err.code);
+ extract.close();
+ update.northstar.updating = false;
+
+ let description = lang("gui.toast.desc.unknown_error") + " (" + err.code + ")";
+
+ if (err.code == "EACCES") {
+ description = lang("gui.toast.desc.permission_denied");
+ }
+
+ win().toast({
+ scheme: "error",
+ title: lang("gui.toast.title.failed"),
+ description: description
+ })
+
+ win().send("ns-update-event", "cli.update.failed");
+ })
+
// extracts the zip, this is the part where we're actually
// installing Northstar.
- extract.pipe(unzip.Extract({path: settings().gamepath}))
+ extract.pipe(destination)
let extracted = 0;
let size = received;