-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asset loading hangs forever when errors hit loading an asset. #5032
Comments
It would be interesting to have an example on how you can catch error or timeout and show a message to the user. |
You can catch the error event that the individual THREE loaders emit. Just: [...document.querySelectorAll('a-asset-item')].forEach(el => { el.addEventListener('error', evt => {
console.error(evt);
// if you decide you want to fool A-Frame into continuing, just run el.emit('loaded',{});
}) (from memory, you can look at a-load-screen for the actual implementation) |
If it's the big glb representing the whole scene that gave an error, I probably want to show the user a message "something went wrong, please try again later" instead of showing a white canvas. If it's smaller glb that may not be so important for the experience, I may want to still enter the experience, yes, but this is a case by case thing. |
yes, you can put whatever handling you want there. you can see what element threw the error and handle accordingly. a basic option would be set and/or just ignore if file is unimportant, which you can see by checking |
Ok, the choice of showing a message to the user or retry downloading an asset that gave an error can be done in your app. An external library that implements another loader can help with that too. |
) * Better handling of asset loading errors. * Simple test for asset loading error. * Ensure all assets loaded even when one is in error. Plus test cases. * fix typos * Remove trailing spaces to pass linting checks. * Fix linting errors arising from merge * Fix up merge * Fix test script that fails due to inadequate mocking of canvas. * Revert "Fix test script that fails due to inadequate mocking of canvas." This reverts commit 84a0d63. * Remove example - this is now tested in UT.
Fixed by 5189765 |
Description:
When a URL referred to by an asset is not resolvable, A-Frame scene loading just hangs forever.
See linked Glitch, which is a modified version of this https://aframe.io/examples/showcase/modelviewer/ but with the GLTF URL set to an invalid value.
One reason why it would be nice to initialize the scene, rather than hang forever, is that it would allow application-specific error handling.
I have a potential fix for this that seems to work, which I'll present as a PR.
The text was updated successfully, but these errors were encountered: