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

Commit 475250d

Browse files
author
Noah Lee
authored
Fix the bug of handling GetConfig (#255)
1 parent bb22d1a commit 475250d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

internal/server/api/v1/repos/deployment.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (r *Repo) CreateDeployment(c *gin.Context) {
8686
re := vr.(*ent.Repo)
8787

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

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

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

internal/server/api/v1/repos/lock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (r *Repo) CreateLock(c *gin.Context) {
8686
u := vu.(*ent.User)
8787

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

0 commit comments

Comments
 (0)