Use a sentinel ErrorResponse for 404 errors, so both `Is()` and `HasStatusCode` work properly

Solves this issue I created 2261. This commit ends up preventing HasStatusCode usage. You have to do two cases, which is unexpected to the end user.


	// go-gitlab returns ErrNotFound (plain sentinel) for 404, not ErrorResponse.
	if errors.Is(err, gitlab.ErrNotFound) {
		return something
	}

	if errResp, ok := errors.AsType[*gitlab.ErrorResponse](err); ok && errResp.Response != nil {
		code := errResp.Response.StatusCode
		if code >= 400 && code < 500 && code != http.StatusTooManyRequests {
			return something too
		}
	}

Merge request reports

Loading