From e7f08c4842bcaa8bf66bd0ca8e298922faff280d Mon Sep 17 00:00:00 2001 From: dmotte <37443982+dmotte@users.noreply.github.com> Date: Thu, 7 Mar 2024 02:12:24 +0100 Subject: [PATCH] Error catching in ui_load --- bnplay-audio-api.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bnplay-audio-api.html b/bnplay-audio-api.html index 8c5e919..6ef6ac6 100644 --- a/bnplay-audio-api.html +++ b/bnplay-audio-api.html @@ -85,10 +85,16 @@ function ui_load() { btnToggle = document.getElementById("btnToggle"); - return bnp_load().then(() => { - btnToggle.removeAttribute("disabled"); - ui_update(); - }); + return bnp_load() + .then(() => { + btnToggle.removeAttribute("disabled"); + ui_update(); + }) + .catch((error) => { + console.log(error); + divStatus.innerHTML = error; + btnToggle.value = "ERROR"; + }); } function ui_update() {