-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PMM-13658 fix updates error response #9
Conversation
@@ -93,7 +93,8 @@ func (handle *Handler) Handle(w http.ResponseWriter, r *http.Request) { | |||
|
|||
func handleError(w http.ResponseWriter, err error) { | |||
if err != nil { | |||
if errors.Is(err, &types.ValidationError{}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors.Is
was only working with sentinel errors (e.g errors created with errors.New
) so it was failing in this case.
pkg/api/update/update_test.go
Outdated
import ( | ||
"errors" | ||
"github.com/containrrr/watchtower/pkg/types" | ||
"net/http" | ||
"net/http/httptest" | ||
"testing" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please format imports
pkg/api/update/update_test.go
Outdated
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
_ = httptest.NewRequest(http.MethodGet, "/v1/update", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No actually, was a spill over
https://perconadev.atlassian.net/browse/PMM-13658