@@ -24,13 +24,15 @@ func (a *APIStore) PostTemplatesTemplateIDTags(c *gin.Context, templateIDOrAlias
2424 body , err := utils .ParseBody [api.AssignTemplateTagRequest ](ctx , c )
2525 if err != nil {
2626 a .sendAPIStoreError (c , http .StatusBadRequest , fmt .Sprintf ("Invalid request body: %s" , err ))
27+
2728 return
2829 }
2930
3031 // Validate tag name
3132 if body .Tag == "" {
3233 a .sendAPIStoreError (c , http .StatusBadRequest , "Tag name is required" )
3334 telemetry .ReportError (ctx , "tag name is required" , nil )
35+
3436 return
3537 }
3638
@@ -50,11 +52,13 @@ func (a *APIStore) PostTemplatesTemplateIDTags(c *gin.Context, templateIDOrAlias
5052 }
5153 a .sendAPIStoreError (c , http .StatusNotFound , fmt .Sprintf ("Template '%s' with tag '%s' not found" , templateIDOrAlias , tag ))
5254 telemetry .ReportError (ctx , "template or source tag not found" , err , telemetry .WithTemplateID (templateIDOrAlias ))
55+
5356 return
5457 }
5558
5659 telemetry .ReportError (ctx , "error when getting template with build" , err )
5760 a .sendAPIStoreError (c , http .StatusInternalServerError , "Error getting template" )
61+
5862 return
5963 }
6064
@@ -66,6 +70,7 @@ func (a *APIStore) PostTemplatesTemplateIDTags(c *gin.Context, templateIDOrAlias
6670 if apiErr != nil {
6771 a .sendAPIStoreError (c , apiErr .Code , apiErr .ClientMsg )
6872 telemetry .ReportCriticalError (ctx , "error when getting team" , apiErr .Err )
73+
6974 return
7075 }
7176
@@ -78,6 +83,7 @@ func (a *APIStore) PostTemplatesTemplateIDTags(c *gin.Context, templateIDOrAlias
7883 if template .TeamID != team .ID {
7984 a .sendAPIStoreError (c , http .StatusForbidden , fmt .Sprintf ("You don't have access to sandbox template '%s'" , templateIDOrAlias ))
8085 telemetry .ReportError (ctx , "no access to the template" , nil , telemetry .WithTemplateID (template .ID ))
86+
8187 return
8288 }
8389
@@ -90,6 +96,7 @@ func (a *APIStore) PostTemplatesTemplateIDTags(c *gin.Context, templateIDOrAlias
9096 if err != nil {
9197 telemetry .ReportCriticalError (ctx , "error when creating tag assignment" , err )
9298 a .sendAPIStoreError (c , http .StatusInternalServerError , "Error creating tag assignment" )
99+
93100 return
94101 }
95102
@@ -121,6 +128,7 @@ func (a *APIStore) DeleteTemplatesTemplateIDTagsTag(c *gin.Context, templateIDOr
121128 if tag == id .DefaultTag {
122129 a .sendAPIStoreError (c , http .StatusBadRequest , fmt .Sprintf ("Cannot delete the '%s' tag" , id .DefaultTag ))
123130 telemetry .ReportError (ctx , "cannot delete default tag" , nil )
131+
124132 return
125133 }
126134
@@ -130,11 +138,13 @@ func (a *APIStore) DeleteTemplatesTemplateIDTagsTag(c *gin.Context, templateIDOr
130138 if dberrors .IsNotFoundError (err ) {
131139 a .sendAPIStoreError (c , http .StatusNotFound , fmt .Sprintf ("Template '%s' not found" , templateIDOrAlias ))
132140 telemetry .ReportError (ctx , "template not found" , err , telemetry .WithTemplateID (templateIDOrAlias ))
141+
133142 return
134143 }
135144
136145 telemetry .ReportError (ctx , "error when getting template" , err )
137146 a .sendAPIStoreError (c , http .StatusInternalServerError , "Error getting template" )
147+
138148 return
139149 }
140150
@@ -143,6 +153,7 @@ func (a *APIStore) DeleteTemplatesTemplateIDTagsTag(c *gin.Context, templateIDOr
143153 if apiErr != nil {
144154 a .sendAPIStoreError (c , apiErr .Code , apiErr .ClientMsg )
145155 telemetry .ReportCriticalError (ctx , "error when getting team" , apiErr .Err )
156+
146157 return
147158 }
148159
@@ -155,6 +166,7 @@ func (a *APIStore) DeleteTemplatesTemplateIDTagsTag(c *gin.Context, templateIDOr
155166 if template .TeamID != team .ID {
156167 a .sendAPIStoreError (c , http .StatusForbidden , fmt .Sprintf ("You don't have access to sandbox template '%s'" , templateIDOrAlias ))
157168 telemetry .ReportError (ctx , "no access to the template" , nil , telemetry .WithTemplateID (template .ID ))
169+
158170 return
159171 }
160172
@@ -166,6 +178,7 @@ func (a *APIStore) DeleteTemplatesTemplateIDTagsTag(c *gin.Context, templateIDOr
166178 if err != nil {
167179 telemetry .ReportCriticalError (ctx , "error when deleting tag assignment" , err )
168180 a .sendAPIStoreError (c , http .StatusInternalServerError , "Error deleting tag assignment" )
181+
169182 return
170183 }
171184
0 commit comments