Repository navigation
Fix: Name and log file in decode errors - #336
Merged
zbdd merged 1 commit intoNov 21, 2026
Merged
Conversation
Backport of #330. (cherry picked from commit b37d514) - Cause: A WebAudio decode error arrives through the decode callback, after the try/catch that logs fetch errors has finished. With no loaded callback it was dropped, and with one the message was only the browser's text, with no file name. WebAudioContext.decode also copied the browser's error into a plain Error, losing its name. - Fix: WebAudioMedia wraps a decode error as "Failed to decode sound from <url>: <browser message>" with the browser's error in cause, and logs it with console.error when there is no callback. The URL is left out for an ArrayBuffer source, and a data URL is cut to its header. WebAudioContext.decode passes the browser's error through, and still falls back to "Unable to decode file" when there is no error or no message. HTML audio is unchanged: it already logs, and its message has no URL. - Tests: decode-error.test.ts covers logging once without a callback and not logging with a callback, a rejected play() or a rejected Assets.load, on both backends. The WebAudio cases check the message for a file URL, a data URL, an ArrayBuffer source, a source given with a URL and Assets, the cause and its name, and the fallback message. The tests are adapted to PixiJS 7: Assets from @pixi/assets with an array alias, and the fetch mock on settings.ADAPTER.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A WebAudio sound that fails to decode now says which file it was, and the error is logged to the console when there is no
loadedcallback to receive it. Before, the error was dropped without a callback, and with one it only carried the browser's text. Backport of #330.Changes
Failed to decode sound from <url>: <browser message>, and the browser's own error is incause.loadedcallback, the error is logged once withconsole.error.data:audio/mpeg;base64,…), and a sound made from anArrayBufferwith no URL getsFailed to decode sound: <browser message>.WebAudioContext.decodepasses on the browser's error, so itsname(for exampleEncodingError) is kept.loadedoption's docs describe the error.