Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
docs: improved errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Feb 10, 2023
1 parent 5dd2000 commit 2e6d8d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (api *bifrostGateway) GetIPNSRecord(ctx context.Context, c cid.Cid) ([]byte
return nil, errors.New("provided cid is not an encoded libp2p key")
}

// The value store expects the key itself to be encoded as a multihash.
// The value store expects the key itself to be multihash.
id, err := peer.FromCid(c)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (ps *proxyRouting) fetch(ctx context.Context, key string) ([]byte, error) {
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status from remote gateway: %s", resp.Status)
return nil, fmt.Errorf("routing/get RPC returned unexpected status: %s", resp.Status)
}

rb, err := io.ReadAll(resp.Body)
Expand All @@ -113,7 +113,7 @@ func (ps *proxyRouting) fetch(ctx context.Context, key string) ([]byte, error) {
var evt routing.QueryEvent
err = json.Unmarshal(part, &evt)
if err != nil {
return nil, fmt.Errorf("routing/get value cannot be parsed: %w", err)
return nil, fmt.Errorf("routing/get RPC response cannot be parsed: %w", err)
}

if evt.Type == routing.Value {
Expand All @@ -123,7 +123,7 @@ func (ps *proxyRouting) fetch(ctx context.Context, key string) ([]byte, error) {
}

if b64 == "" {
return nil, errors.New("routing/get value has no key")
return nil, errors.New("routing/get RPC returned no value")
}

rb, err = base64.StdEncoding.DecodeString(b64)
Expand Down

0 comments on commit 2e6d8d7

Please sign in to comment.