-
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
When will panics become errors that can be handled? #113
Comments
This is already solved at wgpu-core level. All of the things that can error return So I think wgpu-native needs to expose the "on_uncaptured_error" callback, similarly. |
I've begun work on improving the error handling in wgpu-native here: It's not yet finished, but it implements @kvark, could you have a look and tell me if it looks right, or if you had something else in mind? I'd be happy to finish the work. |
That's very nice, thank you @sqaxomonophonen ! It will be convenient to provide feedback on a draft PR if you make one. |
We don't have push/pop error scopes implemented yet here at wgpu-native level, but @sqaxomonophonen just landed the uncaptured error handler and the device lost handlers in #157. |
#264 implemented the push/pop error scopes, and now most the internal errors are handle-able by error scopes. Also we have many |
If I interpret that search result, the
Would be nice. Though I find panic-ing on invalid use of the API (as in C-function arguments) much less of a problem. |
You have to expand the "Show 19 more matches". Don't know it isn't default in github |
Ah, I missed that, thanks! |
What is the current status of this? From what I can tell, there are still code paths that panic even for, AFAICT, valid uses of the API. For example, trying to create an unsupported surface panics with The list of "fatal errors" also seems problematic. For all of those, the C side should be able to fail gracefully, and not have SIGABRT forced on it, the same way that Rust could. (Arguably it would also be convenient if misuses of the C API wouldn't lead to panics, as this would allow higher level language bindings to wgpu-native to use their native panics/exceptions/errors/... Then again, bindings should probably make sure not to pass invalid data to wgpu-native in the first place.) |
Whenever there is a validation error (e.g. a syntax error in the shader) Rust will panic, and bring down the whole process. This makes it hard to do more interactive things (e.g. in dynamic languages like Python). As I've understood it, the panics are a temporary thing and will eventually be replaced with an error mechanism, so that the calling environment can handle the error.
Are there ideas about what this will look like and when this will be happening?
The text was updated successfully, but these errors were encountered: