@@ -90,12 +90,12 @@ func (r *Repo) CreateDeployment(c *gin.Context) {
9090
9191 cf , err := r .i .GetConfig (ctx , u , re )
9292 if e .HasErrorCode (err , e .ErrorCodeConfigNotFound ) {
93- r .log . Error ( "The configuration file is not found." , zap . Error ( err ) )
93+ gb . LogWithError ( r .log , "The configuration file is not found." , err )
9494 // To override the HTTP status 422.
9595 gb .ResponseWithStatusAndError (c , http .StatusUnprocessableEntity , err )
9696 return
9797 } else if err != nil {
98- r .log . Error ( "It has failed to get the configuration." )
98+ gb . LogWithError ( r .log , "It has failed to get the configuration." , err )
9999 gb .ResponseWithError (c , err )
100100 return
101101 }
@@ -122,7 +122,7 @@ func (r *Repo) CreateDeployment(c *gin.Context) {
122122 cf .GetEnv (p .Env ),
123123 )
124124 if err != nil {
125- r .log . Error ( "It has failed to deploy." , zap . Error ( err ) )
125+ gb . LogWithError ( r .log , "It has failed to deploy." , err )
126126 gb .ResponseWithError (c , err )
127127 return
128128 }
@@ -172,12 +172,12 @@ func (r *Repo) UpdateDeployment(c *gin.Context) {
172172
173173 cf , err := r .i .GetConfig (ctx , u , re )
174174 if e .HasErrorCode (err , e .ErrorCodeConfigNotFound ) {
175- r .log . Error ( "The configuration file is not found." , zap . Error ( err ) )
175+ gb . LogWithError ( r .log , "The configuration file is not found." , err )
176176 // To override the HTTP status 422.
177177 gb .ResponseWithStatusAndError (c , http .StatusUnprocessableEntity , err )
178178 return
179179 } else if err != nil {
180- r .log . Error ( "It has failed to get the configuration." )
180+ gb . LogWithError ( r .log , "It has failed to get the configuration." , err )
181181 gb .ResponseWithError (c , err )
182182 return
183183 }
@@ -197,7 +197,7 @@ func (r *Repo) UpdateDeployment(c *gin.Context) {
197197
198198 if p .Status == string (deployment .StatusCreated ) && d .Status == deployment .StatusWaiting {
199199 if d , err = r .i .DeployToRemote (ctx , u , re , d , env ); err != nil {
200- r .log . Error ( "It has failed to deploy to the remote." , zap . Error ( err ) )
200+ gb . LogWithError ( r .log , "It has failed to deploy to the remote." , err )
201201 gb .ResponseWithError (c , err )
202202 return
203203 }
@@ -241,12 +241,12 @@ func (r *Repo) RollbackDeployment(c *gin.Context) {
241241
242242 cf , err := r .i .GetConfig (ctx , u , re )
243243 if e .HasErrorCode (err , e .ErrorCodeConfigNotFound ) {
244- r .log . Error ( "The configuration file is not found." , zap . Error ( err ) )
244+ gb . LogWithError ( r .log , "The configuration file is not found." , err )
245245 // To override the HTTP status 422.
246246 gb .ResponseWithStatusAndError (c , http .StatusUnprocessableEntity , err )
247247 return
248248 } else if err != nil {
249- r .log . Error ( "It has failed to get the configuration." )
249+ gb . LogWithError ( r .log , "It has failed to get the configuration." , err )
250250 gb .ResponseWithError (c , err )
251251 return
252252 }
@@ -274,7 +274,7 @@ func (r *Repo) RollbackDeployment(c *gin.Context) {
274274 cf .GetEnv (d .Env ),
275275 )
276276 if err != nil {
277- r .log . Error ( "It has failed to deploy." , zap . Error ( err ) )
277+ gb . LogWithError ( r .log , "It has failed to deploy." , err )
278278 gb .ResponseWithError (c , err )
279279 return
280280 }
@@ -336,7 +336,7 @@ func (r *Repo) ListDeploymentChanges(c *gin.Context) {
336336 if sha == "" {
337337 sha , err = r .getCommitSha (ctx , u , re , d .Type , d .Ref )
338338 if err != nil {
339- r .log . Error ( "It has failed to get the commit SHA." , zap . Error ( err ) )
339+ gb . LogWithError ( r .log , "It has failed to get the commit SHA." , err )
340340 gb .ResponseWithError (c , err )
341341 return
342342 }
@@ -391,7 +391,7 @@ func (r *Repo) GetConfig(c *gin.Context) {
391391
392392 config , err := r .i .GetConfig (ctx , u , re )
393393 if err != nil {
394- r .log . Error ( "It has failed to get the configuration." , zap . Error ( err ) )
394+ gb . LogWithError ( r .log , "It has failed to get the configuration." , err )
395395 gb .ResponseWithError (c , err )
396396 return
397397 }
0 commit comments