catch any error

This commit is contained in:
Klemek
2024-10-18 18:45:31 +02:00
parent 95c6bb9072
commit b25828f961
+4
View File
@@ -165,6 +165,7 @@ let app = {
}); });
}, },
playRandomSound() { playRandomSound() {
try {
const sound = random.element(this.sounds.filter(sound => sound.active)); const sound = random.element(this.sounds.filter(sound => sound.active));
if (sound !== null) { if (sound !== null) {
console.log(`Playing ${sound.id}`); console.log(`Playing ${sound.id}`);
@@ -172,6 +173,9 @@ let app = {
sound.audio.volume = this.volume / 100; sound.audio.volume = this.volume / 100;
sound.audio.play(); sound.audio.play();
} }
} catch (error) {
console.error(error);
}
this.trigger(); this.trigger();
}, },
}, },