mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-12-24 15:39:11 +08:00
controller: remove controller/errdefs protobuf files
Remove the protobuf files associated with controller/errdefs. This doesn't completely remove the type as the monitor still uses it as a signal to start the monitor. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
@@ -1,48 +1,20 @@
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/containerd/typeurl/v2"
|
||||
"github.com/docker/buildx/util/desktop"
|
||||
"github.com/moby/buildkit/util/grpcerrors"
|
||||
)
|
||||
|
||||
func init() {
|
||||
typeurl.Register((*Build)(nil), "github.com/docker/buildx", "errdefs.Build+json")
|
||||
}
|
||||
|
||||
type BuildError struct {
|
||||
*Build
|
||||
error
|
||||
err error
|
||||
}
|
||||
|
||||
func (e *BuildError) Unwrap() error {
|
||||
return e.error
|
||||
return e.err
|
||||
}
|
||||
|
||||
func (e *BuildError) ToProto() grpcerrors.TypedErrorProto {
|
||||
return e.Build
|
||||
func (e *BuildError) Error() string {
|
||||
return e.err.Error()
|
||||
}
|
||||
|
||||
func (e *BuildError) PrintBuildDetails(w io.Writer) error {
|
||||
if e.Ref == "" {
|
||||
return nil
|
||||
}
|
||||
ebr := &desktop.ErrorWithBuildRef{
|
||||
Ref: e.Ref,
|
||||
Err: e.error,
|
||||
}
|
||||
return ebr.Print(w)
|
||||
}
|
||||
|
||||
func WrapBuild(err error, sessionID string, ref string) error {
|
||||
func WrapBuild(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return &BuildError{Build: &Build{SessionID: sessionID, Ref: ref}, error: err}
|
||||
}
|
||||
|
||||
func (b *Build) WrapError(err error) error {
|
||||
return &BuildError{error: err, Build: b}
|
||||
return &BuildError{err: err}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user