Skip to content

Add onError hook to middlewareEventConsumer #7

@thedevyashsaini

Description

@thedevyashsaini

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions