Skip to content
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.

Commit

Permalink
Pull in m3metrics to validate filter early
Browse files Browse the repository at this point in the history
  • Loading branch information
xichen2020 committed Dec 31, 2017
1 parent eb35ea3 commit 6883c72
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 4 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import:
- package: github.com/m3db/m3cluster
version: 4b25af16e37d029b79bae754d35655e6be382f94
- package: github.com/m3db/m3metrics
version: f5cc881ab5d3577071d9664d60939bb668ed01c2
version: 6fa2c1c82be390b21c9bfc3e6adef37ff31e2cd4
- package: github.com/m3db/m3x
version: 515e3030818e6dab3fd418f05b96174ae4c527df
- package: github.com/apache/thrift
Expand Down
12 changes: 9 additions & 3 deletions service/r2/kv/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import (
"fmt"

"github.com/m3db/m3ctl/service/r2"
"github.com/m3db/m3metrics/errors"
"github.com/m3db/m3metrics/rules"
"github.com/m3db/m3metrics/rules/validator"
"github.com/m3db/m3x/clock"
xerrors "github.com/m3db/m3x/errors"
)

type store struct {
Expand Down Expand Up @@ -395,10 +396,15 @@ func (s *store) handleUpstreamError(err error) error {
return nil
}

// If this is a contained error, extracts the inner error.
if containedErr, ok := err.(xerrors.ContainedError); ok {
err = containedErr.InnerError()
}

switch err.(type) {
case validator.RuleConflictError:
case errors.RuleConflictError:
return r2.NewConflictError(err.Error())
case validator.ValidationError:
case errors.ValidationError:
return r2.NewBadInputError(err.Error())
default:
return r2.NewInternalError(err.Error())
Expand Down

0 comments on commit 6883c72

Please sign in to comment.