diff --git a/promql/engine.go b/promql/engine.go index 009862b7a0..9d22723a87 100644 --- a/promql/engine.go +++ b/promql/engine.go @@ -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. diff --git a/promql/engine_test.go b/promql/engine_test.go index adf99985dc..a219af231a 100644 --- a/promql/engine_test.go +++ b/promql/engine_test.go @@ -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 })