Pixi.js: No error message from Loader, when downloading a sprite sheet and the texture fails to load.

Created on 11 Jan 2018  路  7Comments  路  Source: pixijs/pixi.js

Using the Pixi.Loader, if I download a spritesheet's json, it then tries to download the png related to it, but if the texture fails, the Loader does not call the error handler. Meaning that I currently have to load the png in a first pass, then load the json in a second to capture any errors on loading the png's.

馃暦 Bug

Most helpful comment

Now the console.log via onError is getting triggered: https://jsfiddle.net/4mf95gcr/1/

All 7 comments

That's an issue for https://github.com/englercj/resource-loader

Lets summon the author here. @englercj i choose you!

Also, please provide a fiddle where its not working, its difficult to summon busy people without concrete example.

https://jsfiddle.net/filharvey/sztvvpf7/2/

The png is not there, and it errors out in the spritesheetparser. as the image has not been loaded. But as you can see the onError is not hit.

Actually, no events (besides onStart) are dispatched. This is because the spritesheet parser throws an error when trying to create the frames:

Uncaught Error: Texture Error: frame does not fit inside the base Texture dimensions: X: 1 + 168 = 169 > 1 and Y: 1 + 168 = 169 > 1

Once that error is thrown all JS execution stops, so you won't get any events dispatched. The spritesheet parser should handle getting an errored resource and act accordingly. Simply skipping execution when the resource's .error property is set should be sufficient.

So the sprite sheet parser should throw an error to the callback, so that it knows that the sprite sheet has failed. And then handled how ever is needed.

I added a PR for this. Thanks for digging into it @filharvey. We should be able to verify your fiddle with https://pixijs.download/fix-spritesheet-error/pixi.min.js once Travis finishes.

Now the console.log via onError is getting triggered: https://jsfiddle.net/4mf95gcr/1/

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

distinctdan picture distinctdan  路  3Comments

gigamesh picture gigamesh  路  3Comments

SebastienFPRousseau picture SebastienFPRousseau  路  3Comments

softshape picture softshape  路  3Comments

finscn picture finscn  路  3Comments