Skip to content

An error event with no listener crashes the process, contrary to "errors never crash" #44

Closed

Description

@Shinrai

Problem

The README promised errors never crash the process, but the remote emits error on a Node.js EventEmitter, and Node throws when error is emitted with no listener. A consumer that only listens for connect/key events crashes on the first connection or protocol error. The README now notes that you need an error listener (#41), but the library behaviour is still a trap.

Fix

Only emit error when a listener is attached (listenerCount("error") > 0). Otherwise route it to the debug/log channel, and surface it through the returned promise where an operation is pending. Test that an error with no listener doesn't throw and that one with a listener is delivered. Then remove the README caveat.

Activity

  1. added
    type: bug
    priority: medium
    status: confirmed
    area: core
    on Oct 4, 2026
  2. added
    status: implemented
    and removed
    status: confirmed
    on Oct 4, 2026
  3. cldmv-bot commented on Oct 4, 2026

    @cldmv-bot
    Contributor

    Marked status: implemented — resolved by #46, merged into next. This issue closes automatically when that work ships to the default branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corepriority: mediumstatus: implementedtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions