-
Notifications
You must be signed in to change notification settings - Fork 1.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
wasi-nn: be explicit about the error on BackendError
variants
#7157
Conversation
`BackendAccess` and `GuestAccess` variants contain more information that might be helpful to diagnose an underlying problem. Bubble up that information to the user. Signed-off-by: Rafael Fernández López <rfernandezl@vmware.com>
Thanks! I think the issue though might lie in what's rendering this error to something human readable. The Can you share a reproduction for example to help track down where the error rendering is happening? Or do you know that off the top of your head perchance? When dealing with |
Thank you for the quick response @alexcrichton! I have created https://github.com/ereslibre/wasmtime-wasi-nn-reproducer. It has two branches: The An example of the fail report in the different branches:
Please, note that the error itself only contains the "Failed while accessing backend" message. With this patch (and the one proposed for
|
Just to add more context to my previous message. In the non-detailed version ( #[allow(unused_qualifications)]
impl std::fmt::Display for BackendError {
fn fmt(&self, __formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
#[allow(unused_imports)]
use thiserror::__private::{DisplayAsDisplay, PathAsDisplay};
#[allow(unused_variables, deprecated, clippy::used_underscore_binding)]
match self {
BackendError::BackendAccess(_0) => {
__formatter.write_fmt(format_args!("Failed while accessing backend"))
(snip) In the #[allow(unused_qualifications)]
impl std::fmt::Display for BackendError {
fn fmt(&self, __formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
#[allow(unused_imports)]
use thiserror::__private::{DisplayAsDisplay, PathAsDisplay};
#[allow(unused_variables, deprecated, clippy::used_underscore_binding)]
match self {
BackendError::BackendAccess(_0) => {
__formatter
.write_fmt(
format_args!(
"Failed while accessing backend: {0}",
_0.as_display(),
),
)
}
(snip) |
I'm a bit confused though, the |
Sorry, I think I didn't provide the best example. I was referring only to the display implementation of the error. I have updated both branches of the example, where this is more clear: assuming this is happening in a log entry, the difference is as follows:
The use case I'm thinking about is when this might not be a fatal error, and just logged with the |
Ok yes that makes sense, but my comment above was basically saying that whatever is emitting this log is using |
Yes, that would certainly be an option. Being multi-line output, it might look a bit off when surrounded by other log entries ("something" and "something else"):
I thought having this information in one line was easier in terms of log processing, but I'm fine if you think what we have is enough :) |
Indeed! That seems like something to handle in whatever is rendering the error in my opinion. This PR, by default, means that by default all other renderers of the error will render duplicate information which isn't correct. This to me seems like a bug and/or improvement in the local rendering you have of an error to logs. Much of this is derivative of how errors are designed in Rust. Errors are designed as a chain of errors and each error in the chain should not render everything else in the chain but rather only they themselves. This PR is effectively violating that design principle of errors in Rust. What I might recommend is to either:
|
Yes, thanks a lot for your suggestions and the rationale! |
BackendAccess
andGuestAccess
variants contain more information that might be helpful to diagnose an underlying problem. Bubble up that information to the user.I added this in the context of an openvino installation that was missing
plugins.xml
. Adding this information helped me in finding out the issue.