srijeet0406 commented on a change in pull request #6003:
URL: https://github.com/apache/trafficcontrol/pull/6003#discussion_r675791183
##########
File path: traffic_ops/traffic_ops_golang/profile/profiles.go
##########
@@ -149,7 +149,7 @@ func (prof *TOProfile) Read(h http.Header, useIMS bool)
([]interface{}, error, e
rows, err := prof.ReqInfo.Tx.NamedQuery(query, queryValues)
if err != nil {
- return nil, nil, errors.New("profile read querying: " +
err.Error()), http.StatusInternalServerError, nil
+ return nil, err, errors.New("profile read querying: " +
err.Error()), http.StatusBadRequest, nil
Review comment:
This is an internal database error and should probably remain as an
internal server error.
Instead, what you can do is add another validation for the `param` query
parameter to make sure it's an integer.
Also, you can add the `JOIN` clause for the `profile_parameter` to the main
select query (just like the `cdn` join part), instead of checking for it
separately.
Additionally, as mentioned in the GH issue, there are a lot of client
methods that use the profile param as a string(name), instead of an int(id). We
should probably fix those in this PR as well.
--
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]