Skip to content

Commit

Permalink
chore: add requestID to error message in store validation
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Sep 17, 2024
1 parent bc2444c commit 991e872
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions waku/v2/protocol/store/pb/validation.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package pb

import (
"encoding/hex"
"errors"
"fmt"
)

// MaxContentTopics is the maximum number of allowed contenttopics in a query
Expand All @@ -10,7 +12,6 @@ const MaxContentTopics = 10
var (
errMissingRequestID = errors.New("missing RequestId field")
errMessageHashOtherFields = errors.New("cannot use MessageHashes with ContentTopics/PubsubTopic")
errRequestIDMismatch = errors.New("requestID in response does not match request")
errMaxContentTopics = errors.New("exceeds the maximum number of ContentTopics allowed")
errEmptyContentTopic = errors.New("one or more content topics specified is empty")
errMissingPubsubTopic = errors.New("missing PubsubTopic field")
Expand Down Expand Up @@ -58,7 +59,7 @@ func (x *StoreQueryRequest) Validate() error {

func (x *StoreQueryResponse) Validate(requestID string) error {
if x.RequestId != "" && x.RequestId != requestID {
return errRequestIDMismatch
return fmt.Errorf("requestID %s in response does not match requestID in request %s", hex.EncodeToString([]byte(x.RequestId)), hex.EncodeToString([]byte(requestID)))
}

if x.StatusCode == nil {
Expand Down

0 comments on commit 991e872

Please sign in to comment.