mirror of
https://github.com/ClusterCockpit/cc-metric-store.git
synced 2026-03-03 07:07:29 +01:00
fix error conditional
This commit is contained in:
@@ -36,8 +36,6 @@ type DefaultAPIResponse struct {
|
|||||||
Message string `json:"msg"`
|
Message string `json:"msg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var ErrNoHostOrMetric error = errors.New("[METRICSTORE]> metric or host not found")
|
|
||||||
|
|
||||||
// handleError writes a standardized JSON error response with the given status code.
|
// handleError writes a standardized JSON error response with the given status code.
|
||||||
// It logs the error at WARN level and ensures proper Content-Type headers are set.
|
// It logs the error at WARN level and ensures proper Content-Type headers are set.
|
||||||
func handleError(err error, statusCode int, rw http.ResponseWriter) {
|
func handleError(err error, statusCode int, rw http.ResponseWriter) {
|
||||||
@@ -255,7 +253,7 @@ func handleQuery(rw http.ResponseWriter, r *http.Request) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// Skip Error If Just Missing Host or Metric, Continue
|
// Skip Error If Just Missing Host or Metric, Continue
|
||||||
// Empty Return For Metric Handled Gracefully By Frontend
|
// Empty Return For Metric Handled Gracefully By Frontend
|
||||||
if err != ErrNoHostOrMetric {
|
if err != metricstore.ErrNoHostOrMetric {
|
||||||
msg := err.Error()
|
msg := err.Error()
|
||||||
data.Error = &msg
|
data.Error = &msg
|
||||||
res = append(res, data)
|
res = append(res, data)
|
||||||
|
|||||||
Reference in New Issue
Block a user