chore: update logging

This commit is contained in:
Danish Arora 2024-09-19 12:18:32 +05:30
parent 4554eeab91
commit 692081e2be
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
2 changed files with 16 additions and 2 deletions

View File

@ -37,6 +37,7 @@ export class FilterCore extends BaseProtocol implements IBaseProtocolCore {
wakuMessage: WakuMessage, wakuMessage: WakuMessage,
peerIdStr: string peerIdStr: string
) => Promise<void>, ) => Promise<void>,
private handleError: (error: Error) => Promise<void>,
public readonly pubsubTopics: PubsubTopic[], public readonly pubsubTopics: PubsubTopic[],
libp2p: Libp2p libp2p: Libp2p
) { ) {
@ -301,8 +302,18 @@ export class FilterCore extends BaseProtocol implements IBaseProtocolCore {
() => { () => {
log.info("Receiving pipe closed."); log.info("Receiving pipe closed.");
}, },
(e) => { async (e) => {
log.error("Error with receiving pipe", e); log.error(
"Error with receiving pipe",
e,
" -- ",
"on peer ",
connection.remotePeer.toString(),
" -- ",
"stream ",
stream
);
await this.handleError(e);
} }
); );
} catch (e) { } catch (e) {

View File

@ -54,6 +54,9 @@ class Filter extends BaseProtocolSDK implements IFilter {
await subscription.processIncomingMessage(wakuMessage, peerIdStr); await subscription.processIncomingMessage(wakuMessage, peerIdStr);
}, },
async (error: Error) => {
log.error("Error with receiving pipe", error);
},
connectionManager.configuredPubsubTopics, connectionManager.configuredPubsubTopics,
libp2p libp2p
), ),