dangogh commented on a change in pull request #1864: fix unclosed rows and error overwriting in cdns.go URL: https://github.com/apache/incubator-trafficcontrol/pull/1864#discussion_r167304285
########## File path: traffic_ops/traffic_ops_golang/cdn/cdns.go ########## @@ -128,16 +128,17 @@ FROM cdn c` //if so, it will return an errorType of DataConflict and the type should be appended to the //generic error message returned func (cdn *TOCDN) Update(db *sqlx.DB, user auth.CurrentUser) (error, tc.ApiErrorType) { + rollbackTransaction := true tx, err := db.Beginx() defer func() { - if tx == nil { + if tx == nil || !rollbackTransaction { return } + err := tx.Rollback() if err != nil { - tx.Rollback() - return + log.Errorln(errors.New("rolling back transaction: " + err.Error())) } - tx.Commit() + return Review comment: no need for this return ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services