Просмотр исходного кода

Merge pull request #716 from kalsky/patch-1

Improve AggregateCostModelHandler error messages

Subfield missing and more descriptive invalid rate.
Michael Dresser 5 лет назад
Родитель
Сommit
b3bb1699f0
1 измененных файлов с 3 добавлено и 3 удалено
  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"
 	if (field == "label" || field == "annotation") && len(subfields) == 0 {
-		WriteError(w, BadRequest("Missing aggregation field parameter"))
+		WriteError(w, BadRequest("Missing aggregation subfield parameter"))
 		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" {
-		WriteError(w, BadRequest("Missing aggregation field parameter"))
+		WriteError(w, BadRequest("Rate parameter only supports: hourly, daily, monthly or empty"))
 		return
 	}