Merge pull request #4628 from bboreham/fix-storage-error

Make ErrStorage a concrete type not an interface
This commit is contained in:
Goutham Veeramachaneni 2018-11-14 10:39:16 +01:00 committed by GitHub
commit 1f053f897b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -74,7 +74,7 @@ type (
ErrTooManySamples string
// ErrStorage is returned if an error was encountered in the storage layer
// during query handling.
ErrStorage error
ErrStorage struct{ error }
)
func (e ErrQueryTimeout) Error() string {
@ -86,6 +86,9 @@ func (e ErrQueryCanceled) Error() string {
func (e ErrTooManySamples) Error() string {
return fmt.Sprintf("query processing would load too many samples into memory in %s", string(e))
}
func (e ErrStorage) Error() string {
return e.error.Error()
}
// A Query is derived from an a raw query string and can be run against an engine
// it is associated with.

View file

@ -193,7 +193,7 @@ func TestQueryError(t *testing.T) {
Timeout: 10 * time.Second,
}
engine := NewEngine(opts)
errStorage := ErrStorage(fmt.Errorf("storage error"))
errStorage := ErrStorage{fmt.Errorf("storage error")}
queryable := storage.QueryableFunc(func(ctx context.Context, mint, maxt int64) (storage.Querier, error) {
return &errQuerier{err: errStorage}, nil
})