// ToGRPC will attempt to map the backend containerd error into a grpc error, // using the original error message as a description. // // Further information may be extracted from certain errors depending on their // type. // // If the error is unmapped, the original error will be returned to be handled // by the regular grpc error handling stack. func ToGRPC(err error) error { … } // ToGRPCf maps the error to grpc error codes, assembling the formatting string // and combining it with the target error string. // // This is equivalent to errdefs.ToGRPC(fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err)) func ToGRPCf(err error, format string, args ...interface{ … } // FromGRPC returns the underlying error from a grpc service based on the grpc error code func FromGRPC(err error) error { … } // rebaseMessage removes the repeats for an error at the end of an error // string. This will happen when taking an error over grpc then remapping it. // // Effectively, we just remove the string of cls from the end of err if it // appears there. func rebaseMessage(cls error, err error) string { … } func isGRPCError(err error) bool { … } func code(err error) codes.Code { … } func errDesc(err error) string { … }