Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Fix the bug of handling GetConfig #255

Merged
merged 1 commit into from
Dec 8, 2021
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
6 changes: 3 additions & 3 deletions internal/server/api/v1/repos/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *Repo) CreateDeployment(c *gin.Context) {
re := vr.(*ent.Repo)

config, err := r.i.GetConfig(ctx, u, re)
if e.HasErrorCode(err, e.ErrorCodeEntityNotFound) {
if err != nil {
r.log.Check(gb.GetZapLogLevel(err), "Failed to get the configuration.").Write(zap.Error(err))
gb.ResponseWithStatusAndError(c, http.StatusUnprocessableEntity, err)
return
Expand Down Expand Up @@ -158,7 +158,7 @@ func (r *Repo) UpdateDeployment(c *gin.Context) {
}

config, err := r.i.GetConfig(ctx, u, re)
if e.HasErrorCode(err, e.ErrorCodeEntityNotFound) {
if err != nil {
r.log.Check(gb.GetZapLogLevel(err), "Failed to get the configuration.").Write(zap.Error(err))
gb.ResponseWithStatusAndError(c, http.StatusUnprocessableEntity, err)
return
Expand Down Expand Up @@ -221,7 +221,7 @@ func (r *Repo) RollbackDeployment(c *gin.Context) {
}

config, err := r.i.GetConfig(ctx, u, re)
if e.HasErrorCode(err, e.ErrorCodeEntityNotFound) {
if err != nil {
r.log.Check(gb.GetZapLogLevel(err), "Failed to get the configuration.").Write(zap.Error(err))
gb.ResponseWithStatusAndError(c, http.StatusUnprocessableEntity, err)
return
Expand Down
2 changes: 1 addition & 1 deletion internal/server/api/v1/repos/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *Repo) CreateLock(c *gin.Context) {
u := vu.(*ent.User)

config, err := r.i.GetConfig(ctx, u, re)
if e.HasErrorCode(err, e.ErrorCodeEntityNotFound) {
if err != nil {
r.log.Check(gb.GetZapLogLevel(err), "Failed to get the configuration.").Write(zap.Error(err))
gb.ResponseWithStatusAndError(c, http.StatusUnprocessableEntity, err)
return
Expand Down