-
Notifications
You must be signed in to change notification settings - Fork 106
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
Model.onModelError doesn't allow dismissing the error and error message is always undefined #312
Comments
Nice find - and I definitely need to make a change here. Sounds like you are thinking of something like so, at that point if
What I have now doesn't actually make sense. I should be passing the message and the possibly undefined exception to the callback instead. In the end though I think I should still be rejecting. What about if you used an error boundary - I think that's how it's meant to be handled: |
Thanks for the reply! Yes I was thinking of something like stopPropogation() or a return value from the onModelError event to tell if it was handled. And yes, passing the error vs the loadedModel to the onModelError makes more sense. ILoadedModel has an optional error message field but it doesn't get populated in the error case so it would be good populate it or to pass the error if adding a way to handle the error from the callback. I'll check out using an error boundary. That was what I think I was missing as a way to work around this. |
Unfortunately wrapping Model in an ErrorBoundary (or even further up the tree) did not work. Maybe has to do with how fiber bridges across?? I still get... |
ok - i'll try to make a codesandbox to test it out... |
hi @don-sitebionics Seems like an option might be to indicate to scene loader via opt-in if it should throw on error on simply return empty "model" object with an error attached. I can also try/catch in the What do you think? The error overlay if you had one was probably something for dev mode only (ie: the full page exception in browser), so maybe that's not a bad thing? What I have in sandbox above doesn't have an unhandled exception. |
Sorry for the delay... Model takes in an onModelError and an onModelLoaded. I think the right behavior is to call onModelLoaded when it succeeds and onModelError when it fails. But I think the signature for onModelError should be changed. There is no reason to pass back a model when it hasn't been loaded. Can... |
Ok. I’ll change the signature. That’s an easy fix - also, I won’t throw an error then. |
I forgot about this - sorry. I am trying to clean up the outstanding issues. This one is relatively easy to fix - stay tuned... |
add: return loading error in callback (instead of missing Model) #312
@don-sitebionics I fixed the callback signature. I don't know if that will resolve as it is still throwing, so it may require an error boundary. I can not throw if that seems like a desired behaviour - Do you have time to try v3.2 and see if it works for you? |
Hi Brian, Thanks for the update. I’m traveling right now but I’ll give a shot as soon as I get back.
Many thanks!
Don
From: Brian Zinn ***@***.***>
Sent: Monday, June 10, 2024 9:48 AM
To: brianzinn/react-babylonjs ***@***.***>
Cc: Don Gillett ***@***.***>; Mention ***@***.***>
Subject: Re: [brianzinn/react-babylonjs] Model.onModelError doesn't allow dismissing the error and error message is always undefined (Issue #312)
@don-sitebionics<https://github.com/don-sitebionics> I fixed the callback signature. I don't know if that will resolve as it is still throwing, so it may require an error boundary. I can not throw if that seems like a desired behaviour - Do you have time to try v3.2 and see if it works for you?
—
Reply to this email directly, view it on GitHub<#312 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BCARIPYAE2MWSTJBLK3OYYLZGXKEJAVCNFSM6AAAAABFB2B426VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJYHA2TKMBWGY>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
If you give sceneFilename a URL that is no longer available then the Model generates and error and I am able to catch that error in the onModelError event. While I am notified of the error there is no way to mark it is handled. The error makes it back to the page and the browser shows afull page unhandled exception error. Is there a feature that I'm missing, a needed feature, or should I be doing something on the page to catch this somehow? Note that model.errorMessage is also always null in the handler. I think the fix should be to pass another parameter allowing the handler to mark it as handled.
The text was updated successfully, but these errors were encountered: