aboutsummaryrefslogtreecommitdiff
path: root/src/modules/update.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2024-12-20 13:08:59 +0100
committerGitHub <noreply@github.com>2024-12-20 13:08:59 +0100
commit8fddf38701f50015ee8f61ce7bc8978f1dcebfd3 (patch)
treea94eb7a0a5b1e469839a6a14400e15be2b61c5b2 /src/modules/update.js
parent14c12f9bf74f7ae7e9b4b873e67b8e9769cdad1e (diff)
parent4ae37f2f520c8082a00cc52f33ea0c1877709d6f (diff)
downloadViper-8fddf38701f50015ee8f61ce7bc8978f1dcebfd3.tar.gz
Viper-8fddf38701f50015ee8f61ce7bc8978f1dcebfd3.zip
Merge pull request #249 from Jan200101/PR/handle-permission-error
feat: handle unzip errors
Diffstat (limited to 'src/modules/update.js')
-rw-r--r--src/modules/update.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/modules/update.js b/src/modules/update.js
index c001ba8..7469e02 100644
--- a/src/modules/update.js
+++ b/src/modules/update.js
@@ -401,9 +401,32 @@ 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 + ")";
+
+ 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;