-
Notifications
You must be signed in to change notification settings - Fork 149
Description
There is a pattern in the gltf crate of calling unwrap after calling nth on an iter, one example of which can be found here. My understanding is that the crate is written this way with the expectation that if all validations pass, none of these unwraps should actually panic. However, in our case, we are reporting all validation errors but still attempting a best-effort load of the gltf/glb data that is healthy. Since there is no way to detect that an accessor function will panic before calling it, other than some intensive introspection on the validation errors, we have resorted to using catch_unwind in these scenarios. I believe it would be more rustic, and provide a nicer interface, if these functions each had a corresponding try_* version which returned a Result and allowed the caller to determine if a panic should occur.
If this seems like a reasonable addition, I am happy to take on the work of putting up a PR.