@@ -2,8 +2,8 @@ package divideSeries
22
33import (
44 "context"
5- "errors"
65 "fmt"
6+ "github.com/go-graphite/carbonapi/pkg/errors"
77 "math"
88
99 "github.com/go-graphite/carbonapi/expr/helper"
@@ -33,7 +33,7 @@ func New(configFile string) []interfaces.FunctionMetadata {
3333// divideSeries(dividendSeriesList, divisorSeriesList)
3434func (f * divideSeries ) Do (ctx context.Context , e parser.Expr , from , until int64 , values map [parser.MetricRequest ][]* types.MetricData ) ([]* types.MetricData , error ) {
3535 if e .ArgsLen () < 1 {
36- return nil , parser .ErrMissingTimeseries
36+ return nil , errors .ErrMissingTimeseries { Target : e . Target ()}
3737 }
3838
3939 firstArg , err := helper .GetSeriesArg (ctx , e .Arg (0 ), from , until , values )
@@ -69,15 +69,15 @@ func (f *divideSeries) Do(ctx context.Context, e parser.Expr, from, until int64,
6969 }
7070
7171 if len (denominators ) > 1 {
72- return nil , types .ErrWildcardNotAllowed
72+ return nil , errors .ErrWildcardNotAllowed { Target : e . Target (), Arg : e . Arg ( 1 ). ToString ()}
7373 }
7474
7575 denominator = denominators [0 ]
7676 } else if len (firstArg ) == 2 && e .ArgsLen () == 1 {
7777 numerators = append (numerators , firstArg [0 ])
7878 denominator = firstArg [1 ]
7979 } else {
80- return nil , errors .New ( "must be called with 2 series or a wildcard that matches exactly 2 series" )
80+ return nil , errors.ErrBadData { Target : e . Target (), Msg : "must be called with 2 series or a wildcard that matches exactly 2 series" }
8181 }
8282
8383 for _ , numerator := range numerators {
0 commit comments