diff --git a/dashboard/assets/js/music/html-music-wrapper.js b/dashboard/assets/js/music/html-music-wrapper.js
index 6ab9511..06db6fd 100644
--- a/dashboard/assets/js/music/html-music-wrapper.js
+++ b/dashboard/assets/js/music/html-music-wrapper.js
@@ -2,7 +2,11 @@ class HTMLMusicWrapper {
#music;
set apiError(error) {
- console.log(error);
+ if (!error)
+ return $('#musicAPIError').addClass('d-none');
+
+ $('#musicAPIError').removeClass('d-none');
+ $('#musicAPIError').text(error.message ?? 'Unknown error.');
}
constructor(musicClient) {
diff --git a/dashboard/assets/js/music/music-wrapper.js b/dashboard/assets/js/music/music-wrapper.js
index 37e9ccd..4ef339c 100644
--- a/dashboard/assets/js/music/music-wrapper.js
+++ b/dashboard/assets/js/music/music-wrapper.js
@@ -16,16 +16,23 @@ class MusicWrapper {
return json;
} catch (error) {
this.#html.apiError = error;
+ throw error;
}
}
async play(query) {
- await this.#fetch(`play?q=${query}`);
+ try {
+ await this.#fetch(`play?q=${query}`);
+ this.#html.apiError = null;
+ } catch {}
await this.updateList();
}
async stop() {
- await this.#fetch(`stop`);
+ try {
+ await this.#fetch(`stop`);
+ this.#html.apiError = null;
+ } catch {}
await this.updateList();
}