Skip to content

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

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

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: coreTouches core library / runtime source codepriority: mediumShould be addressed in the normal course of developmentstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: bugSomething is broken or not behaving as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions