Skip to content

Commit

Permalink
Merge branch 'main' into rm_deprecations_env-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored Jul 27, 2023
2 parents b5dac1e + 6d373da commit 106dc0d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/api/badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ func GetBadge(c *gin.Context) {

pipeline, err := _store.GetPipelineLast(repo, branch)
if err != nil {
log.Warn().Err(err).Msg("")
if !errors.Is(err, types.RecordNotExist) {
log.Warn().Err(err).Msg("could not get last pipeline for badge")
}
pipeline = nil
}

Expand Down Expand Up @@ -110,7 +112,12 @@ func GetCC(c *gin.Context) {
}

pipelines, err := _store.GetPipelineList(repo, &model.ListOptions{Page: 1, PerPage: 1})
if err != nil || len(pipelines) == 0 {
if err != nil && !errors.Is(err, types.RecordNotExist) {
log.Warn().Err(err).Msg("could not get pipeline list")
c.AbortWithStatus(http.StatusInternalServerError)
return
}
if len(pipelines) == 0 {
c.AbortWithStatus(http.StatusNotFound)
return
}
Expand Down

0 comments on commit 106dc0d

Please sign in to comment.