From 69a19430e79f88695dc4a30c9edc19c057e4a2a1 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Fri, 4 Jan 2019 15:44:07 -0600 Subject: [PATCH] Remote audio load handles errors properly --- audio.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/audio.js b/audio.js index 4fdfb34..caa12fe 100644 --- a/audio.js +++ b/audio.js @@ -60,7 +60,13 @@ function loadRemoteAudio(name) { xhr.open("GET", audioBaseUrl + name, true); xhr.responseType = "arraybuffer"; - xhr.onload = (xhr) => cacheAndParse(name, xhr.data); + xhr.onload = (xhr) => { + if (xhr.status == 200) + cacheAndParse(name, xhr.data); + else + console.log("Couldn't load " + name); + } + xhr.onerror = (xhr) => console.log("Couldn't load " + name); xhr.send(); }