Skip to content

Commit 005b94a

Browse files
committed
webui/js: prevent freeze caused by thrown error
tho I think this will not happen Signed-off-by: KOWX712 <[email protected]>
1 parent cd946b8 commit 005b94a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

webui/file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function loadVersion() {
77
exec(`grep "^version=" ${moddir}/module.prop | cut -d= -f2`).then((result) => {
88
if (result.errno !== 0) return;
99
document.getElementById('version').innerHTML = result.stdout.trim();
10-
});
10+
}).catch(() => {});
1111
}
1212

1313
export async function loadConfig() {
@@ -43,7 +43,7 @@ export async function loadConfig() {
4343
return;
4444
}
4545
window.location.reload();
46-
});
46+
}).catch(() => {});
4747
}
4848
}
4949

webui/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ async function showModuleSelector() {
268268
</md-list-item>
269269
`;
270270
}).join('');
271-
});
271+
}).catch(() => {});
272272

273273
const saveConfig = () => {
274274
const selectedModules = Array.from(list.querySelectorAll('md-checkbox'))
@@ -279,7 +279,7 @@ async function showModuleSelector() {
279279
if (result.errno !== 0) {
280280
toast('Failed to save: ' + result.stderr);
281281
}
282-
});
282+
}).catch(() => {});
283283
}
284284

285285
saveBtn.onclick = () => {
@@ -350,7 +350,7 @@ document.addEventListener('DOMContentLoaded', async () => {
350350
if (btn.value === 'reboot') {
351351
exec('/system/bin/reboot').then((result) => {
352352
if (result.errno !== 0) toast('Failed to reboot: ' + result.stderr);
353-
});
353+
}).catch(() => {});
354354
}
355355
}
356356
});
@@ -363,12 +363,12 @@ document.addEventListener('DOMContentLoaded', async () => {
363363
document.getElementById('ksu-tab').classList.remove('hidden');
364364
initSwitch('/data/adb/ksu/.nomount', 'nomount');
365365
initSwitch('/data/adb/ksu/.notmpfs', 'notmpfs');
366-
});
366+
}).catch(() => {});
367367
exec('su -c "command -v apd"').then((isAp) => {
368368
if (isAp.errno !== 0 && isAp.stderr !== "ksu is not defined") return
369369
document.getElementById('ap-tab').classList.remove('hidden');
370370
initSwitch('/data/adb/.litemode_enable', 'litemode')
371-
});
371+
}).catch(() => {});
372372

373373
document.querySelectorAll('[unresolved]').forEach(el => {
374374
el.removeAttribute('unresolved');

0 commit comments

Comments
 (0)