Repository navigation
Fix: Report fetch and HTTP errors when loading a sound - #291
Merged
Merged
Conversation
- Fetch and arrayBuffer() failures become "Failed to load sound from <url>: <message>" with the original error as cause - A non-ok response is reported as "HTTP <status>" without decoding the body, which used to fail decode and call loaded twice, or log nothing with no callback - Decode errors still reach loaded unchanged - Tests assert after loaded settles, so a failed expect shows its diff instead of a timeout
zbdd
force-pushed
the
fix/load-url-errors
branch
from
October 30, 2026 03:58
c138a06 to
9494ee0
Compare
zbdd
added a commit
that referenced
this pull request
Nov 21, 2026
Backport of #291 (cherry picked from commit 63a2318) - Cause: #280 already sent fetch and `arrayBuffer()` failures to `loaded` once on v5.x, but a non-ok response was still decoded, so a 404 failed with a vague decode error. No error named the URL. - Fix: Take main's `_loadUrl`/`_fetch` split, with `settings.ADAPTER` in place of `DOMAdapter.get()`. Fetch and `arrayBuffer()` failures become "Failed to load sound from <url>: <message>" with the original error as `cause`. A non-ok response is reported as "HTTP <status>" without decoding the body. Decode errors still reach `loaded` unchanged. - Tests: Replace #280's four load-error tests in `test/webaudio.test.ts` with #291's five, using `settings.ADAPTER`. The dropped "decode throws" case is covered by the new "decode error unchanged" test, which also checks the error is passed through as is. Co-authored-by: Zac Durber <109934035+zac-vgw@users.noreply.github.com>
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
If the fetch or
response.arrayBuffer()inWebAudioMedia._loadUrlrejects, the error never reachesloaded.load()doesnt handle the returned promise, so all you get is an unhandled rejection with no URL in it.Through
Assetsthat meansAssets.load/loadBundlenever settles, and on pixi 8.19 the loader'sonErrorandretry/skipstrategies never run either.A 404 or 500 doesn't reject
fetch, so the error body gets decoded instead. That callsloadedtwice with a decode error that doesn't say which file, and with noloadedit logs nothing.#280 is the same try/catch for v5.x. The URL and HTTP status handling here is new.
Changes
arrayBuffer()failures reachloadedasFailed to load sound from <url>: <message>with the original error ascause, or go toconsole.errorwhen there's no callbackHTTP <status>, without reading the bodyloadedas before, without the URLAssets.loadthe URL shows twice andcauseis lost, since the loader builds a new error from the message