Skip to content

Commit 51a8f8c

Browse files
efahlsystemcrash
authored andcommitted
luci-app-attendedsysupgrade: add more robust handling of downloads
Check various aspects of the overview and revision downloads from the sysupgrade site, giving the user better error messages when things go wrong. Partially addresses issue #7687 with respect to diagnosis, but not root cause. Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
1 parent 5e39cf0 commit 51a8f8c

File tree

1 file changed

+20
-17
lines changed
  • applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade

1 file changed

+20
-17
lines changed

applications/luci-app-attendedsysupgrade/htdocs/luci-static/resources/view/attendedsysupgrade/overview.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,22 @@ return view.extend({
8787
let changes, target_revision;
8888

8989
await Promise.all([
90-
request.get(overview_url).then(
91-
(response) => {
92-
let json = response.json();
93-
changes = json.branches[get_branch(version)].package_changes;
94-
},
95-
(failed) => {
96-
ui.addNotification(null, E('p', _(`Get overview failed ${failed}`)));
97-
}
98-
),
99-
request.get(revision_url).then(
100-
(response) => {
101-
target_revision = get_revision_count(response.json().revision);
102-
},
103-
(failed) => {
104-
ui.addNotification(null, E('p', _(`Get revision failed ${failed}`)));
105-
}
106-
),
90+
request.get(overview_url)
91+
.then(response => response.json())
92+
.then(json => json.branches)
93+
.then(branches => branches[get_branch(version)])
94+
.then(branch => { changes = branch.package_changes; })
95+
.catch(error => {
96+
throw Error(`Get overview failed:<br>${overview_url}<br>${error}`);
97+
}),
98+
99+
request.get(revision_url)
100+
.then(response => response.json())
101+
.then(json => json.revision)
102+
.then(revision => { target_revision = get_revision_count(revision); })
103+
.catch(error => {
104+
throw Error(`Get revision failed:<br>${revision_url}<br>${error}`);
105+
}),
107106
]);
108107

109108
for (const change of changes) {
@@ -595,6 +594,10 @@ return view.extend({
595594
}, this);
596595
poll.add(this.pollFn, 5);
597596
poll.start();
597+
})
598+
.catch(error => {
599+
ui.addNotification(null, E('p', error.message));
600+
ui.hideModal();
598601
});
599602
});
600603
}),

0 commit comments

Comments
 (0)