Skip to content

Commit 7da3107

Browse files
authored
Merge pull request #3164 from jsternberg/controller-errdefs-proto-removal
controller: remove controller/errdefs protobuf files
2 parents 6df3a09 + 384f056 commit 7da3107

File tree

8 files changed

+8
-441
lines changed

8 files changed

+8
-441
lines changed

cmd/buildx/main.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"path/filepath"
88

99
"github.com/docker/buildx/commands"
10-
controllererrors "github.com/docker/buildx/controller/errdefs"
1110
"github.com/docker/buildx/util/desktop"
1211
"github.com/docker/buildx/version"
1312
"github.com/docker/cli/cli"
@@ -112,11 +111,6 @@ func main() {
112111
var ebr *desktop.ErrorWithBuildRef
113112
if errors.As(err, &ebr) {
114113
ebr.Print(cmd.Err())
115-
} else {
116-
var be *controllererrors.BuildError
117-
if errors.As(err, &be) {
118-
be.PrintBuildDetails(cmd.Err())
119-
}
120114
}
121115

122116
os.Exit(1)

commands/build.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ func runControllerBuild(ctx context.Context, dockerCli command.Cli, opts *cbuild
470470
if err != nil {
471471
var be *controllererrors.BuildError
472472
if errors.As(err, &be) {
473-
ref = be.SessionID
474473
retErr = err
475474
// We can proceed to monitor
476475
} else {

controller/errdefs/build.go

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,20 @@
11
package errdefs
22

3-
import (
4-
"io"
5-
6-
"github.com/containerd/typeurl/v2"
7-
"github.com/docker/buildx/util/desktop"
8-
"github.com/moby/buildkit/util/grpcerrors"
9-
)
10-
11-
func init() {
12-
typeurl.Register((*Build)(nil), "github.com/docker/buildx", "errdefs.Build+json")
13-
}
14-
153
type BuildError struct {
16-
*Build
17-
error
4+
err error
185
}
196

207
func (e *BuildError) Unwrap() error {
21-
return e.error
8+
return e.err
229
}
2310

24-
func (e *BuildError) ToProto() grpcerrors.TypedErrorProto {
25-
return e.Build
11+
func (e *BuildError) Error() string {
12+
return e.err.Error()
2613
}
2714

28-
func (e *BuildError) PrintBuildDetails(w io.Writer) error {
29-
if e.Ref == "" {
30-
return nil
31-
}
32-
ebr := &desktop.ErrorWithBuildRef{
33-
Ref: e.Ref,
34-
Err: e.error,
35-
}
36-
return ebr.Print(w)
37-
}
38-
39-
func WrapBuild(err error, sessionID string, ref string) error {
15+
func WrapBuild(err error) error {
4016
if err == nil {
4117
return nil
4218
}
43-
return &BuildError{Build: &Build{SessionID: sessionID, Ref: ref}, error: err}
44-
}
45-
46-
func (b *Build) WrapError(err error) error {
47-
return &BuildError{error: err, Build: b}
19+
return &BuildError{err: err}
4820
}

controller/errdefs/errdefs.pb.go

Lines changed: 0 additions & 141 deletions
This file was deleted.

controller/errdefs/errdefs.proto

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)