net::ERR_CONNECTION_REFUSED error for AssetManager

Hi,
found some issue during testing that error net::ERR_CONNECTION_REFUSED somehow goes through catch and assets manager continues without throwing error, anyone have seen this case ?
I tried to find how to catch such errors but without much luck, maybe anyone have ideas here.
As if this happens game continue to load but end up with half loaded , like mesh are there but textures for mesh not.

Also saw such error in console net::ERR_NETWORK_CHANGED 200 for some images

Thank you

If that happens I see error in console Error while trying to load image:

Assets manager:

const assetManager = new AssetsManager(scene);
assetManager.useDefaultLoadingScreen = false;
assetsManager.addMeshTask(Tools.RandomId(), "", path, "");
assetsManager.loadAsync().then(resolve)
            .catch((err) => {
                // SHOW error popup and abort game
            });

Engine settings:

engine.enableOfflineSupport =false;
engine.renderEvenInBackground = true;
engine.disableManifestCheck = true;
SceneLoader.ForceFullSceneLoadingForIncremental = true;
SceneLoader.ShowLoadingScreen = false;

hey, sorry - i am a bit confused. Is that the solution or the error? If it is the error, want to create a playground and explain what the expectations are?

Just a note about net::ERR_NETWORK_CHANGED - this is probably coming from the server/network architecture and not from babylon.js

Hey @RaananW I get such errors, that goes through assetsManager.loadAsync().then(resolve).catch()

I get bunch of errors like Error while trying to load image

but asset loader catch is not called,
before that I see ERR_CONNECTION_REFUSED or ERR_NETWORK_CHANGED 200
could be that they break this

will try to get more data, but its not easy to reproduce :slight_smile:

1 Like

The image loading mechanism is rather straight forward:

        var img = new Image();

        Tools.SetCorsBehavior(this.url, img);

        img.onload = () => {
            this.image = img;
            onSuccess();
        };

        img.onerror = (err: string | Event): any => {
            onError("Error loading image", err);
        };

        img.src = this.url;

if the browser sets it as an error it will call the onError function. But there might be an issue with the loadAsync function. Whenever you can, please try reproducing this. in the meantime I am analyzing the load function