Context middlewareEventConsumer currently logs validation / gRPC errors internally but does not allow callers to react. There are TODOs in Scrawn.js/packages/scrawn/src/core/scrawn.ts indicating a callback is desired.
Goal Allow SDK users to provide an optional onError callback that runs when the middleware fails to track an event (validation or gRPC failure).
Acceptance Criteria
middlewareEventConsumer config accepts optional onError callback.
onError receives { error, req, payload? } (or equivalent) for:
- validation failure
- gRPC failure
- unexpected runtime error
- Existing behavior remains backward compatible.
Notes
- Keep callback optional
- Do not throw from middleware unless user callback throws.
Context
middlewareEventConsumercurrently logs validation / gRPC errors internally but does not allow callers to react. There are TODOs inScrawn.js/packages/scrawn/src/core/scrawn.tsindicating a callback is desired.Goal Allow SDK users to provide an optional
onErrorcallback that runs when the middleware fails to track an event (validation or gRPC failure).Acceptance Criteria
middlewareEventConsumerconfig accepts optional onError callback.onErrorreceives{ error, req, payload? }(or equivalent) for:Notes