Do not fail when receiving unspecified error

This commit is contained in:
Franck Royer 2022-06-15 19:24:27 +10:00
parent 9e8d4b9bb1
commit ce24c2f530
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 5 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import { Peer } from "libp2p/src/peer-store";
import PeerId from "peer-id"; import PeerId from "peer-id";
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";
@ -14,6 +15,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,7 +221,8 @@ export class WakuStore {
const response = reply.response as protoV2Beta4.HistoryResponse; const response = reply.response as protoV2Beta4.HistoryResponse;
if (response.error) { console.log("Response", response);
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;
} }