Skip to content

Callback-API task failures emit error before calling the callback, crashing processes with no error listener #53

Description

@Shinrai

Problem

When a callback-style task fails, times out or is aborted, the queue emits error before invoking the task's callback. With no error listener attached, Node.js throws on the emit, so the process crashes and the callback never runs. A timeout example in the README did exactly that during verification (#50). A callback-API user handling errors in their callback shouldn't also need a queue-wide listener to stay alive.

Fix

Only emit error when a listener is attached (listenerCount("error") > 0), and always deliver the failure to the task's callback or promise. Test a failing, a timed-out and an aborted callback task with no error listener: no throw, and the callback receives the documented payload. Then drop 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: highNeeds attention soon — not blocking, but don't let it sitstatus: 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