You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/12/07 03:00:03 UTC

[trafficcontrol] branch master updated: Fix TO Go cdnfeds empty/error codes&msgs (#2857)

This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new f5b344d  Fix TO Go cdnfeds empty/error codes&msgs (#2857)
f5b344d is described below

commit f5b344d3d253ff81fa98dc16f6ae23949b7feda8
Author: Robert Butts <ro...@users.noreply.github.com>
AuthorDate: Thu Dec 6 19:59:57 2018 -0700

    Fix TO Go cdnfeds empty/error codes&msgs (#2857)
---
 traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go b/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go
index 28317cb..19ff6a8 100644
--- a/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go
+++ b/traffic_ops/traffic_ops_golang/cdnfederation/cdnfederations.go
@@ -180,13 +180,13 @@ func (fed *TOCDNFederation) Read() ([]interface{}, error, error, int) {
 	}
 
 	if len(filteredFederations) == 0 {
-		if fed.ID == nil {
-			return nil, nil, nil, http.StatusNotFound
+		if fed.ID != nil {
+			return nil, errors.New("not found"), nil, http.StatusNotFound
 		}
 		if ok, err := dbhelpers.CDNExists(fed.APIInfo().Params["name"], fed.APIInfo().Tx); err != nil {
 			return nil, nil, errors.New("verifying CDN exists: " + err.Error()), http.StatusInternalServerError
 		} else if !ok {
-			return nil, nil, nil, http.StatusNotFound
+			return nil, errors.New("cdn not found"), nil, http.StatusNotFound
 		}
 	}
 	return filteredFederations, nil, nil, http.StatusOK