Description
This issue aims to address the implementation of onError Hook for EscrowMonitor.
The core objective is to: Give EscrowMonitor (src/escrow/monitor.ts) a way to surface polling and handler errors — via the SDK's existing SDKLogger (src/utils/logger.ts) and an optional onError callback — instead of silently discarding them. EscrowMonitor.startPolling currently does const events = await fetchFn().catch(() => []) — any error from the caller-supplied fetchFn (e.g. a network failure fetching events) is silently swallowed and polling just continues with an empty event list, with no way for the consumer to know a poll failed. Handler errors are only slightly better surfaced: Promise.resolve(h(event)).catch(console.error) logs to raw console.error with no prefix/timestamp/structure, bypassing the SDK's own SDKLogger (currently unused anywhere per a companion issue) entirely, and gives the consumer no way to react.
By completing this feature, we will ensure that the TrustFlow protocol maintains its high standards for security, usability, and decentralized logic. This issue requires careful attention to the SDK Wrapper architecture and adherence to the existing project conventions.
Component
SDK
Difficulty
🟡 Medium
Tasks
Acceptance Criteria
Estimated Time
1-2 days
Description
This issue aims to address the implementation of onError Hook for EscrowMonitor.
The core objective is to: Give
EscrowMonitor(src/escrow/monitor.ts) a way to surface polling and handler errors — via the SDK's existingSDKLogger(src/utils/logger.ts) and an optionalonErrorcallback — instead of silently discarding them.EscrowMonitor.startPollingcurrently doesconst events = await fetchFn().catch(() => [])— any error from the caller-suppliedfetchFn(e.g. a network failure fetching events) is silently swallowed and polling just continues with an empty event list, with no way for the consumer to know a poll failed. Handler errors are only slightly better surfaced:Promise.resolve(h(event)).catch(console.error)logs to rawconsole.errorwith no prefix/timestamp/structure, bypassing the SDK's ownSDKLogger(currently unused anywhere per a companion issue) entirely, and gives the consumer no way to react.By completing this feature, we will ensure that the TrustFlow protocol maintains its high standards for security, usability, and decentralized logic. This issue requires careful attention to the SDK Wrapper architecture and adherence to the existing project conventions.
Component
SDK
Difficulty
🟡 Medium
Tasks
EscrowMonitor)onError(error, context)callback onEscrowMonitor, invoked for bothfetchFnfailures and handler failuresconsole.errorcall with the SDK's logger (or make logging pluggable via the same mechanism)typedoccomments for the new featurefetchFn-failure and handler-failure paths invokeonErrorAcceptance Criteria
onErrorEstimated Time
1-2 days