You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is just a thought that I'm posting as an issue to keep track of it.
Currently, in order to determine if an error is caused by a missing resource in hcsshim, clients need to take a dependency on hcsshim and use hcsshim.IsNotFound(). This is better than raw errors and error strings, but I think it could be done in a more scale-able way.
I wonder if we could do this in a more generic way in the future, such that clients who want to determine if an error is caused by a resource not existing do not need to take a dependency on hcsshim (assuming the hcsshim error filters a few layers, or even projects, above where it is read).
I think this would be best done with something like https://github.com/pkg/errors for Cause wrapping instead of my current implementation of getInnerError and an unexported (but guaranteed stable) isNotFound interface with some method such as .NotFound() and errors which implement that method. Clients could then just define the same interface in their code and at runtime determine if the error is caused by a missing resource without needing to know which underlying package caused the error.
This would be best defined outside hcsshim so that other platform layers could implement the same interface, and it is not just Microsoft/* that uses it. I don't have the time to look into if something like this already exists in Go, but storing this to come back to it at a later date. If not, pkg/errors might want to host something like this.
The text was updated successfully, but these errors were encountered:
This is just a thought that I'm posting as an issue to keep track of it.
Currently, in order to determine if an error is caused by a missing resource in hcsshim, clients need to take a dependency on hcsshim and use
hcsshim.IsNotFound()
. This is better than raw errors and error strings, but I think it could be done in a more scale-able way.I wonder if we could do this in a more generic way in the future, such that clients who want to determine if an error is caused by a resource not existing do not need to take a dependency on hcsshim (assuming the hcsshim error filters a few layers, or even projects, above where it is read).
I think this would be best done with something like https://github.com/pkg/errors for Cause wrapping instead of my current implementation of
getInnerError
and an unexported (but guaranteed stable) isNotFound interface with some method such as .NotFound() and errors which implement that method. Clients could then just define the same interface in their code and at runtime determine if the error is caused by a missing resource without needing to know which underlying package caused the error.This would be best defined outside hcsshim so that other platform layers could implement the same interface, and it is not just Microsoft/* that uses it. I don't have the time to look into if something like this already exists in Go, but storing this to come back to it at a later date. If not, pkg/errors might want to host something like this.
The text was updated successfully, but these errors were encountered: