fix: ignore store response unspecified error

This commit is contained in:
Franck Royer 2022-07-25 19:12:20 +10:00 committed by fryorcraken.eth
parent d18a5152ef
commit 275eb72959
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import { Libp2p } from "libp2p";
import { concat } from "uint8arrays/concat"; import { concat } from "uint8arrays/concat";
import * as protoV2Beta4 from "../../proto/store_v2beta4"; import * as protoV2Beta4 from "../../proto/store_v2beta4";
import { HistoryResponse } from "../../proto/store_v2beta4";
import { DefaultPubSubTopic, StoreCodecs } from "../constants"; import { DefaultPubSubTopic, StoreCodecs } from "../constants";
import { getPeersForProtocol, selectRandomPeer } from "../select_peer"; import { getPeersForProtocol, selectRandomPeer } from "../select_peer";
import { hexToBytes } from "../utils"; import { hexToBytes } from "../utils";
@ -15,6 +16,8 @@ import { DecryptionMethod, WakuMessage } from "../waku_message";
import { HistoryRPC, PageDirection } from "./history_rpc"; import { HistoryRPC, PageDirection } from "./history_rpc";
import Error = HistoryResponse.Error;
const dbg = debug("waku:store"); const dbg = debug("waku:store");
export const DefaultPageSize = 10; export const DefaultPageSize = 10;
@ -218,8 +221,8 @@ export class WakuStore {
const response = reply.response as protoV2Beta4.HistoryResponse; const response = reply.response as protoV2Beta4.HistoryResponse;
if (response.error) { if (response.error && response.error !== Error.ERROR_NONE_UNSPECIFIED) {
throw "History response contains an Error" + response.error; throw "History response contains an Error: " + response.error;
} }
if (!response.messages || !response.messages.length) { if (!response.messages || !response.messages.length) {