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

Make ErrStorage a concrete type not an interface
pull/4866/head
Goutham Veeramachaneni 6 years ago committed by GitHub
commit 1f053f897b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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.

@ -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
})

Loading…
Cancel
Save