Skip to content

Commit 1f053f8

Browse files
authored
Merge pull request prometheus#4628 from bboreham/fix-storage-error
Make ErrStorage a concrete type not an interface
2 parents 181f07e + 9a95687 commit 1f053f8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

promql/engine.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type (
7474
ErrTooManySamples string
7575
// ErrStorage is returned if an error was encountered in the storage layer
7676
// during query handling.
77-
ErrStorage error
77+
ErrStorage struct{ error }
7878
)
7979

8080
func (e ErrQueryTimeout) Error() string {
@@ -86,6 +86,9 @@ func (e ErrQueryCanceled) Error() string {
8686
func (e ErrTooManySamples) Error() string {
8787
return fmt.Sprintf("query processing would load too many samples into memory in %s", string(e))
8888
}
89+
func (e ErrStorage) Error() string {
90+
return e.error.Error()
91+
}
8992

9093
// A Query is derived from an a raw query string and can be run against an engine
9194
// it is associated with.

promql/engine_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func TestQueryError(t *testing.T) {
193193
Timeout: 10 * time.Second,
194194
}
195195
engine := NewEngine(opts)
196-
errStorage := ErrStorage(fmt.Errorf("storage error"))
196+
errStorage := ErrStorage{fmt.Errorf("storage error")}
197197
queryable := storage.QueryableFunc(func(ctx context.Context, mint, maxt int64) (storage.Querier, error) {
198198
return &errQuerier{err: errStorage}, nil
199199
})

0 commit comments

Comments
 (0)