srijeet0406 commented on a change in pull request #6023:
URL: https://github.com/apache/trafficcontrol/pull/6023#discussion_r675174225
##########
File path: traffic_ops/traffic_ops_golang/cachegroup/cachegroups.go
##########
@@ -688,7 +686,7 @@ func (cg *TOCacheGroup) handleCoordinateUpdate() (*int,
error, error, int) {
}
if err = cg.updateCoordinate(); err != nil {
- return nil, nil, tc.DBError, http.StatusInternalServerError
+ return nil, err, tc.DBError, http.StatusBadRequest
Review comment:
So since this might actually be a database error, this should still
return an Internal Server Error in my opinion.
What you could do is add a check at the start of the `Update` method
checking to see if the cachegroup with the given name(from the request body)
has the same ID as that passed in the request. If true, then proceed, else,
return a 400 or 409 status code with the correct error (something like
`cachegroup name should be unique`).
Also, could you pls add some tests for this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]