Slaus

Loader: reload failed resources

Recommended Posts

Hello. My game loads many resources (100+); on specific PC occasional weird error happens: net::ERR_CONNECTION_RESET 200 OK for several files so loading abrupts. I failed to google what that error even means and every time it happens to different files and in 1 in 20 times game loads successfully. Errors I dealt with previously was 404 (Not Found) which was caused both by absent network or absent files, so I was just reloading the whole page hoping for network connection to recover.

Anyway, error is an error, so failed files need to be recovered somehow, but I don't know how to do it yet. How can I know what files failed to load?

Quote

PIXI.loader.onError.add( w => console.log( w ) )

Prints: Error: Failed to load element using: IMG

Is there a way to know which file failed to load? How can I add failed file back to the loading bundle continuing the ongoing loading process? If sub-resource failed to load (for example, .png file of .json spritesheet) should I re-queue that sub-resource or it's parent?

Thanks in advance.

Share this post


Link to post
Share on other sites

I had that problem in production. What i did - I reset() the loader and added everything again. On any error. But I guess its not for your case: 

it happens to different files and in 1 in 20 times game loads successfully. 

So far I didn't see code that does reloading of individual resources in case of error in public (forum, issues). Please share it if you make something.

It shouldn't be that difficult, if you read sources of resource-loader ( https://github.com/englercj/resource-loader/ )

Edited by ivan.popelyshev

Share this post


Link to post
Share on other sites

Thank for your answer, Ivan. I've got an answer from Engler about OnError being called with the error, the loader, and the resource that failed. http://englercj.github.io/resource-loader/classes/loader.html#onerrorsignal

Got too used to error handlers being called with single error objects, so didn't look for docs, sorry my bad.

Since I didn't know how to catch what files failed to load, so I just reset the loader and reload all the resources again relying on browser cache to handle repeats and it magically worked well.

Thanks for your help.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.