Returning a 404 if no metrics are found.

This commit is contained in:
Aleksandr Melnikov
2020-03-10 15:47:38 -07:00
parent 196a90692d
commit fac5e5cbab

View File

@@ -2,6 +2,8 @@ package server
import ( import (
"context" "context"
"github.com/onepanelio/core/pkg/util"
"google.golang.org/grpc/codes"
"math" "math"
"sort" "sort"
"strings" "strings"
@@ -189,6 +191,9 @@ func (s *WorkflowServer) GetWorkflowExecutionMetrics(ctx context.Context, req *a
Format: m.Format, Format: m.Format,
}) })
} }
if len(apiMetrics) == 0 {
return nil, util.NewUserError(codes.NotFound, "Metrics were not found.")
}
return &api.GetWorkflowExecutionMetricsResponse{Metrics: apiMetrics}, nil return &api.GetWorkflowExecutionMetricsResponse{Metrics: apiMetrics}, nil
} }