Open seebs opened 9 months ago
@seebs why is the origin code equivalent to
case notFound: return http.StatusNotFound
case error: return http.InternalServerError
the below test cases all passed
func TestCheckRequestError(t *testing.T) {
badRequestErr := badRequest{errors.New("xxx")}
assert.Equal(t, 400, checkRequestError(badRequestErr))
var notFoundErr notFound = errors.New("not found")
assert.Equal(t, 404, checkRequestError(notFoundErr))
err := errors.New("error")
assert.Equal(t, 404, checkRequestError(err))
}
this is simplified from an actual case where we got bitten by this. this is equivalent to:
which I think SA4020 would catch.