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

Commit

Permalink
Fix the bug of handling GetConfig (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Lee authored Dec 8, 2021
1 parent bb22d1a commit 475250d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 475250d

Please sign in to comment.