From: Joe Wreschnig Date: Mon, 13 Jul 2015 22:39:28 +0000 (+0200) Subject: Include URL in audio load error message. X-Git-Url: https://git.yukkurigames.com/?p=pwl6.git;a=commitdiff_plain;h=5deeff54e19003703e7ffb3ee1d3406c3092ebf9 Include URL in audio load error message. --- diff --git a/src/yuu/audio.js b/src/yuu/audio.js index 0e543a7..cc00cf7 100644 --- a/src/yuu/audio.js +++ b/src/yuu/audio.js @@ -89,7 +89,7 @@ currentTime: { alias: "_ctx.currentTime" }, - decodeAudioData: function (data) { + decodeAudioData: function (data, hint) { var ctx = this._ctx; try { return ctx.decodeAudioData(data); @@ -98,7 +98,8 @@ ctx.decodeAudioData(data, function (buffer) { resolve(buffer); }, function () { - reject(new Error("Error decoding audio buffer")); + reject(new Error("Error decoding audio buffer" + + (hint ? ": " + hint : ""))); }); }); } @@ -174,7 +175,9 @@ var url = yuu.resourcePath(path, "sound", "wav"); this.data = null; this.ready = yuu.GET(url, { responseType: "arraybuffer" }) - .then(ctx.decodeAudioData.bind(ctx)) + .then(function (data) { + return ctx.decodeAudioData(data, url); + }) .then(yf.setter.bind(this, "buffer")) .then(yf.K(this)); }