mattjackson220 commented on a change in pull request #4470: Deprecate keys/ping
URL: https://github.com/apache/trafficcontrol/pull/4470#discussion_r390515343
##########
File path: traffic_ops/traffic_ops_golang/ping/keys.go
##########
@@ -20,25 +20,29 @@ package ping
*/
import (
- "errors"
+ "github.com/apache/trafficcontrol/lib/go-tc"
"net/http"
"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api"
"github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/riaksvc"
)
func Keys(w http.ResponseWriter, r *http.Request) {
+ alerts := tc.CreateAlerts(tc.WarnLevel, "This endpoint is deprecated")
inf, userErr, sysErr, errCode := api.NewInfo(r, nil, nil)
if userErr != nil || sysErr != nil {
- api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+ userErr = api.LogErr(r, errCode, userErr, sysErr)
+ alerts.AddAlerts(tc.CreateErrorAlerts(userErr))
+ api.WriteAlerts(w, r, errCode, alerts)
return
}
defer inf.Close()
pingResp, err := riaksvc.Ping(inf.Tx.Tx, inf.Config.RiakAuthOptions,
inf.Config.RiakPort)
if err != nil {
- api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError,
nil, errors.New("error pinging Riak keys: "+err.Error()))
+ alerts.AddAlerts(tc.CreateErrorAlerts(userErr))
+ api.WriteAlerts(w, r, http.StatusInternalServerError, alerts)
Review comment:
same here regarding HandleDeprecatedErr
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services