Skip to content

Commit

Permalink
feat: rollback on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel-Haeberli committed Aug 7, 2023
1 parent a404649 commit bb96dd9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions momentum-core/routers/application-router.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (a *ApplicationRouter) addApplication(c *gin.Context) {

application, err := a.applicationService.AddApplication(request, traceId)
if err != nil {
transaction.Rollback(ctx)
c.IndentedJSON(http.StatusBadRequest, models.NewApiError(err, http.StatusBadRequest, c, traceId))
config.LOGGER.LogError(err.Error(), err, traceId)
return
Expand Down
1 change: 1 addition & 0 deletions momentum-core/routers/deployment-router.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (d *DeploymentRouter) addDeployment(c *gin.Context) {

deployment, err := d.deploymentService.AddDeployment(request, traceId)
if err != nil {
transaction.Rollback(ctx)
c.IndentedJSON(http.StatusBadRequest, models.NewApiError(err, http.StatusBadRequest, c, traceId))
config.LOGGER.LogError(err.Error(), err, traceId)
return
Expand Down
1 change: 1 addition & 0 deletions momentum-core/routers/stage-router.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (sr *StageRouter) addStage(c *gin.Context) {

stage, err := sr.stageService.AddStage(request, traceId)
if err != nil {
transaction.Rollback(ctx)
c.IndentedJSON(http.StatusBadRequest, models.NewApiError(err, http.StatusBadRequest, c, traceId))
config.LOGGER.LogError(err.Error(), err, traceId)
return
Expand Down

0 comments on commit bb96dd9

Please sign in to comment.