Skip to content

Commit f95a00b

Browse files
authored
fix: fileUpload error casting does not conform to interface (#486)
1 parent 99d733e commit f95a00b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

go/porcelain/deploy.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"time"
2222

2323
"github.com/cenkalti/backoff/v4"
24-
apierrors "github.com/go-openapi/errors"
2524
"github.com/pkg/errors"
2625
"github.com/rsc/goversion/version"
2726
"github.com/sirupsen/logrus"
@@ -100,6 +99,11 @@ type DeployOptions struct {
10099
functionsConfig map[string]models.FunctionConfig
101100
}
102101

102+
type deployApiError interface {
103+
error
104+
Code() int
105+
}
106+
103107
type uploadError struct {
104108
err error
105109
mutex *sync.Mutex
@@ -537,7 +541,7 @@ func (n *Netlify) uploadFile(ctx context.Context, d *models.Deploy, f *FileBundl
537541

538542
if operationError != nil {
539543
context.GetLogger(ctx).WithError(operationError).Errorf("Failed to upload file %v", f.Name)
540-
apiErr, ok := operationError.(apierrors.Error)
544+
apiErr, ok := operationError.(deployApiError)
541545

542546
if ok && apiErr.Code() == 401 {
543547
sharedErr.mutex.Lock()

0 commit comments

Comments
 (0)