Fix store error serialization to gRPC status codes
The pkg/store errors are duplicated errors of NotFound and AlreadyExist from containerd's errdefs package and thus do not properly serialize when running errdefs.ToGRPC on them. CRI runs this function on every return from a CRI method so the conversion fails if there is a cache miss from the store caches for containers or sandboxes. This change verifies that the errors are properly converted to their gRPC values. Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
committed by
Justin Terry (SF)
parent
c0294ebfe0
commit
a8cc66b37a
@@ -16,12 +16,18 @@ limitations under the License.
|
||||
|
||||
package store
|
||||
|
||||
import "errors"
|
||||
import "github.com/containerd/containerd/errdefs"
|
||||
|
||||
var (
|
||||
// ErrAlreadyExist is the error returned when data added in the store
|
||||
// already exists.
|
||||
ErrAlreadyExist = errors.New("already exists")
|
||||
//
|
||||
// This error has been DEPRECATED and will be removed in 1.5. Please switch
|
||||
// usage directly to `errdefs.ErrAlreadyExists`.
|
||||
ErrAlreadyExist = errdefs.ErrAlreadyExists
|
||||
// ErrNotExist is the error returned when data is not in the store.
|
||||
ErrNotExist = errors.New("does not exist")
|
||||
//
|
||||
// This error has been DEPRECATED and will be removed in 1.5. Please switch
|
||||
// usage directly to `errdefs.ErrNotFound`.
|
||||
ErrNotExist = errdefs.ErrNotFound
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user