mirror of
https://github.com/status-im/go-waku.git
synced 2025-02-26 20:10:44 +00:00
chore: add requestID to error message in store validation
This commit is contained in:
parent
bc2444ca46
commit
991e872de9
@ -1,7 +1,9 @@
|
|||||||
package pb
|
package pb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MaxContentTopics is the maximum number of allowed contenttopics in a query
|
// MaxContentTopics is the maximum number of allowed contenttopics in a query
|
||||||
@ -10,7 +12,6 @@ const MaxContentTopics = 10
|
|||||||
var (
|
var (
|
||||||
errMissingRequestID = errors.New("missing RequestId field")
|
errMissingRequestID = errors.New("missing RequestId field")
|
||||||
errMessageHashOtherFields = errors.New("cannot use MessageHashes with ContentTopics/PubsubTopic")
|
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")
|
errMaxContentTopics = errors.New("exceeds the maximum number of ContentTopics allowed")
|
||||||
errEmptyContentTopic = errors.New("one or more content topics specified is empty")
|
errEmptyContentTopic = errors.New("one or more content topics specified is empty")
|
||||||
errMissingPubsubTopic = errors.New("missing PubsubTopic field")
|
errMissingPubsubTopic = errors.New("missing PubsubTopic field")
|
||||||
@ -58,7 +59,7 @@ func (x *StoreQueryRequest) Validate() error {
|
|||||||
|
|
||||||
func (x *StoreQueryResponse) Validate(requestID string) error {
|
func (x *StoreQueryResponse) Validate(requestID string) error {
|
||||||
if x.RequestId != "" && x.RequestId != requestID {
|
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 {
|
if x.StatusCode == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user