Updating Errors, and adding license

This commit is contained in:
John Delivuk 2019-02-22 10:04:10 -05:00
parent 8ef8c8a291
commit 980bc01d67
No known key found for this signature in database
GPG key ID: 8597474A0655625E
3 changed files with 27 additions and 15 deletions

View file

@ -92,11 +92,11 @@ func (n *queryBuilder) processQueryParts(queryParts []queryPart) ([]string, map[
// We obviously can't generate label filters for these cases.
fmt.Println("This is queryPart", qPart.labelName, qPart.operator, qPart.values)
if qPart.labelName == "" {
return nil, nil, ErrNewLabelNotSpecified
return nil, nil, ErrLabelNotSpecified
}
if !n.operatorIsSupported(qPart.operator) {
return nil, nil, ErrNewOperatorNotSupportedByPrometheus
return nil, nil, ErrUnsupportedOperator
}
matcher, err := n.selectMatcher(qPart.operator, qPart.values)
@ -128,7 +128,7 @@ func (n *queryBuilder) selectMatcher(operator selection.Operator, values []strin
case selection.DoesNotExist:
return prom.LabelEq, nil
case selection.Equals, selection.DoubleEquals, selection.NotEquals, selection.In, selection.NotIn:
return nil, ErrNewOperatorRequiresValues
return nil, ErrMalformedQuery
}
} else if numValues == 1 {
switch operator {
@ -168,7 +168,7 @@ func (n *queryBuilder) selectTargetValue(operator selection.Operator, values []s
// whose value is NOT "".
return "", nil
case selection.Equals, selection.DoubleEquals, selection.NotEquals, selection.In, selection.NotIn:
return "", ErrNewOperatorRequiresValues
return "", ErrMalformedQuery
}
} else if numValues == 1 {
switch operator {
@ -194,7 +194,7 @@ func (n *queryBuilder) selectTargetValue(operator selection.Operator, values []s
// for their label selector.
return strings.Join(values, "|"), nil
case selection.Exists, selection.DoesNotExist:
return "", ErrNewOperatorDoesNotSupportValues
return "", ErrQueryUnsupportedValues
}
}