You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
616 B
Go
35 lines
616 B
Go
package errdefs
|
|
|
|
import (
|
|
"github.com/containerd/typeurl/v2"
|
|
"github.com/moby/buildkit/util/grpcerrors"
|
|
)
|
|
|
|
func init() {
|
|
typeurl.Register((*Build)(nil), "github.com/docker/buildx", "errdefs.Build+json")
|
|
}
|
|
|
|
type BuildError struct {
|
|
Build
|
|
error
|
|
}
|
|
|
|
func (e *BuildError) Unwrap() error {
|
|
return e.error
|
|
}
|
|
|
|
func (e *BuildError) ToProto() grpcerrors.TypedErrorProto {
|
|
return &e.Build
|
|
}
|
|
|
|
func WrapBuild(err error, ref string) error {
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
return &BuildError{Build: Build{Ref: ref}, error: err}
|
|
}
|
|
|
|
func (b *Build) WrapError(err error) error {
|
|
return &BuildError{error: err, Build: *b}
|
|
}
|