Skip to content

[Bug] Route dispatcher errors through the system Logger/EventStream #410

Description

@pathosDev

Rationale

runSafely in src/Dispatcher.ts logs swallowed handler errors via console.error (lines 17 and 21), bypassing the Logger and the EventStream entirely. These errors are invisible to JsonLogger, the OTel log bridge, MDC context — and to tests. Since ActorCell.run() itself has no catch-all, framework-level failures surface only through this console path.

Wiring constraint: the dispatcher is constructed before the logger in ActorSystem, so it cannot take the logger in its constructor.

Scope

  • Injectable onError sink on dispatchers, wired post-construction by ActorSystem to the system logger and published to the EventStream (e.g. a DispatcherError event).
  • console.error remains only as the last-resort fallback when no sink was ever wired.
  • Remove direct console usage from src/ hot paths.

Documentation

  • CHANGELOG Fixed; short observability docs note (EN + DE).

Acceptance

  • Unit test observes a thrown handler error via the EventStream.
  • No console.error under src/ except the documented last-resort fallback.

Relates

Improvement program M2. #259 (error hierarchy).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: mediumUseful, not urgentproduction-goalBlocks or defines the path to production readiness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions