mirror of https://github.com/waku-org/js-waku.git
fix: ignore store response unspecified error
This commit is contained in:
parent
d18a5152ef
commit
275eb72959
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue