added error handling

This commit is contained in:
2023-02-06 16:44:17 +01:00
parent 749e8b43d5
commit 3285770d97
7 changed files with 41 additions and 6 deletions

View File

@@ -1,9 +1,27 @@
window.electronAPI.updateProgress(async (_event, value) => {
window.electronAPI.updateProgress((_event, value) => {
console.log(_event)
console.log(value)
updateProgressStep(value);
})
window.electronAPI.handleError((_event, value) => {
let error = `
<div class="titlebar">NCOS Companion</div>
<div class="content">
<h1 class="centered">An Error Occured</h1>
<div class="row">
<div class="col-12">
<h4 class="centered">${value.label}</h4>
<h4 class="centered">pleas report this to <a class="link" target="_blank" href="https://github.com/Vortex-Dynamics/NervUpdaterClient/issues">us</a></h4>
<pre class="centered">${value.err}</pre>
</div>
</div>
</div>
`;
document.querySelector("body").innerHTML = error;
})
function updateProgressBar(progress){
document.getElementById("progress-bar").style.width = progress + "%";
document.getElementById("progress-label").textContent = progress + "%";