Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func CollectApiPullRequestCommits(taskCtx plugin.SubTaskContext) errors.Error {
Input: iterator,
UrlTemplate: "rest/api/1.0/projects/{{ .Params.FullName }}/pull-requests/{{ .Input.BitbucketId }}/commits",
ResponseParser: GetRawMessageFromResponse,
AfterResponse: ignoreHTTPStatus404,
})
if err != nil {
return err
Expand Down
12 changes: 12 additions & 0 deletions backend/plugins/bitbucket_server/tasks/task_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ limitations under the License.
package tasks

import (
"net/http"

"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/bitbucket_server/models"
Expand Down Expand Up @@ -77,3 +79,13 @@ func ValidateTaskOptions(op *BitbucketServerOptions) errors.Error {
}
return nil
}

func ignoreHTTPStatus404(res *http.Response) errors.Error {
if res.StatusCode == http.StatusUnauthorized {
return errors.Unauthorized.New("authentication failed, please check your AccessToken")
}
if res.StatusCode == http.StatusNotFound {
return api.ErrIgnoreAndContinue
}
return nil
}