2020-04-22 01:28:29 +00:00
|
|
|
package errdefs
|
|
|
|
|
2020-04-23 01:30:19 +00:00
|
|
|
import (
|
|
|
|
"github.com/moby/buildkit/util/grpcerrors"
|
2020-05-13 15:37:27 +00:00
|
|
|
digest "github.com/opencontainers/go-digest"
|
2020-04-23 01:30:19 +00:00
|
|
|
)
|
2020-04-22 01:28:29 +00:00
|
|
|
|
|
|
|
type VertexError struct {
|
|
|
|
Vertex
|
|
|
|
error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *VertexError) Unwrap() error {
|
|
|
|
return e.error
|
|
|
|
}
|
|
|
|
|
2020-04-23 01:30:19 +00:00
|
|
|
func (e *VertexError) ToProto() grpcerrors.TypedErrorProto {
|
|
|
|
return &e.Vertex
|
|
|
|
}
|
|
|
|
|
2020-04-22 01:28:29 +00:00
|
|
|
func WrapVertex(err error, dgst digest.Digest) error {
|
|
|
|
if err == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return &VertexError{Vertex: Vertex{Digest: dgst.String()}, error: err}
|
|
|
|
}
|
2020-04-23 01:30:19 +00:00
|
|
|
|
|
|
|
func (v *Vertex) WrapError(err error) error {
|
|
|
|
return &VertexError{error: err, Vertex: *v}
|
|
|
|
}
|