mirror of https://github.com/waku-org/js-waku.git
Do not fail when receiving unspecified error
This commit is contained in:
parent
9e8d4b9bb1
commit
ce24c2f530
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue