I try to load 2 files, 1 success 1 failed but the complete call back give me 2 success.

Short story long:
I am trying to load an xml that define what files I will actually load, after loading the xml file, the code load a sample image file with path provided from xml. However, the path is wrong as intended and it does failed to load with error message, and I expect the complete call back to give me 1 success and 1 failure (otherwise, I don’t know what that totalFailed is for ). At the end, complete callback unexpectedly give me 2 totalComplete and 0 totalFailed, is it a bug or am I missing something?


              loader: Phaser.Loader.LoaderPlugin,
              totalComplete: number,
              totalFailed: number
            ) => {
                NAME + " load complete... ",
                `success =  ${totalComplete}, `,
                `failed = ${totalFailed}`


PhaserDynamicModal load complete...  success =  2,  failed = 0

Hi. What is the load image code and what is the error message exactly?

the error log:

Failed to process file: image "sample-image" 
    error suppress-nextjs-warning.ts:7
    overrideMethod (index):13024
    onProcessError phaser.js:117395
    onerror phaser.js:123675
    (Async: EventHandlerNonNull)
    onProcess phaser.js:123671
    nextFile phaser.js:118515
    onLoad phaser.js:117311

the load code:

    let key = node.getAttribute("key") as string;
    Must.true(key.length > 0);

    var img = node.getAttribute("img");
    if (img) this.scene.load.image(key, img);

and the corresponding xml entry for the image path :slight_smile:

<load key="sample-image" img="assets/not_exist.png" />

Which Phaser version is it? It’s possible an earlier version didn’t count “process failures” as failures but I don’t remember exactly.

That error probably means the server is sending 200 ok instead of 404 not found. You may be able to change that somehow.

According to package.json

"phaser": "^3.70.0",

The server is indeed redirecting user to home page when requesting a non-exist file. I think I could change that based on media type.

Anyway, I think failure of the image parsing should also count to failure instead of success in this case because the user only care whether the resource can be used or not, not on which preparing stage it fail. Otherwise, the fail count would be less useful.


I guess I was wrong and this is how it’s supposed to work. :confused: