diff --git a/internal/pipe/artifactory/artifactory.go b/internal/pipe/artifactory/artifactory.go index e3c5034b50d..bdc4a3b1d65 100644 --- a/internal/pipe/artifactory/artifactory.go +++ b/internal/pipe/artifactory/artifactory.go @@ -79,7 +79,7 @@ func checkResponse(r *h.Response) error { if err == nil && data != nil { err := json.Unmarshal(data, errorResponse) if err != nil { - return err + return fmt.Errorf("unexpected error: %w: %s", err, string(data)) } } return errorResponse diff --git a/internal/pipe/artifactory/artifactory_test.go b/internal/pipe/artifactory/artifactory_test.go index d8e9ce0cd8b..e7192801d46 100644 --- a/internal/pipe/artifactory/artifactory_test.go +++ b/internal/pipe/artifactory/artifactory_test.go @@ -461,11 +461,7 @@ func TestRunPipe_UnparsableErrorResponse(t *testing.T) { requireHeader(t, r, "Authorization", "Basic ZGVwbG95dXNlcjpkZXBsb3l1c2VyLXNlY3JldA==") w.WriteHeader(http.StatusUnauthorized) - fmt.Fprint(w, `...{ - "errors" : [ { - ... - } ] - }`) + fmt.Fprint(w, `

error

`) }) ctx := context.New(config.Project{ @@ -495,7 +491,7 @@ func TestRunPipe_UnparsableErrorResponse(t *testing.T) { }) require.NoError(t, Pipe{}.Default(ctx)) - require.EqualError(t, Pipe{}.Publish(ctx), `artifactory: upload failed: invalid character '.' looking for beginning of value`) + require.EqualError(t, Pipe{}.Publish(ctx), `artifactory: upload failed: unexpected error: invalid character '<' looking for beginning of value:

error

`) } func TestRunPipe_FileNotFound(t *testing.T) {