mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
vendor: update buildkit with typed errors support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
36
vendor/github.com/moby/buildkit/solver/errdefs/vertex.go
generated
vendored
Normal file
36
vendor/github.com/moby/buildkit/solver/errdefs/vertex.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"github.com/containerd/typeurl"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
digest "github.com/opencontainers/go-digest"
|
||||
)
|
||||
|
||||
func init() {
|
||||
typeurl.Register((*Vertex)(nil), "github.com/moby/buildkit", "errdefs.Vertex+json")
|
||||
typeurl.Register((*Source)(nil), "github.com/moby/buildkit", "errdefs.Source+json")
|
||||
}
|
||||
|
||||
type VertexError struct {
|
||||
Vertex
|
||||
error
|
||||
}
|
||||
|
||||
func (e *VertexError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func (e *VertexError) ToProto() grpcerrors.TypedErrorProto {
|
||||
return &e.Vertex
|
||||
}
|
||||
|
||||
func WrapVertex(err error, dgst digest.Digest) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &VertexError{Vertex: Vertex{Digest: dgst.String()}, error: err}
|
||||
}
|
||||
|
||||
func (v *Vertex) WrapError(err error) error {
|
||||
return &VertexError{error: err, Vertex: *v}
|
||||
}
|
Reference in New Issue
Block a user