Explorar el Código

Merge pull request #716 from kalsky/patch-1

Improve AggregateCostModelHandler error messages

Subfield missing and more descriptive invalid rate.
Michael Dresser hace 5 años
padre
commit
b3bb1699f0
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      pkg/costmodel/aggregation.go

+ 3 - 3
pkg/costmodel/aggregation.go

@@ -2012,13 +2012,13 @@ func (a *Accesses) AggregateCostModelHandler(w http.ResponseWriter, r *http.Requ
 
 
 	// aggregation subfield is required when aggregation field is "label"
 	// aggregation subfield is required when aggregation field is "label"
 	if (field == "label" || field == "annotation") && len(subfields) == 0 {
 	if (field == "label" || field == "annotation") && len(subfields) == 0 {
-		WriteError(w, BadRequest("Missing aggregation field parameter"))
+		WriteError(w, BadRequest("Missing aggregation subfield parameter"))
 		return
 		return
 	}
 	}
 
 
-	// enforce one of four available rate options
+	// enforce one of the available rate options
 	if opts.Rate != "" && opts.Rate != "hourly" && opts.Rate != "daily" && opts.Rate != "monthly" {
 	if opts.Rate != "" && opts.Rate != "hourly" && opts.Rate != "daily" && opts.Rate != "monthly" {
-		WriteError(w, BadRequest("Missing aggregation field parameter"))
+		WriteError(w, BadRequest("Rate parameter only supports: hourly, daily, monthly or empty"))
 		return
 		return
 	}
 	}