Skip to content

in on("task_failed", handler) , when maxTimeout error is emitted, the error input must be an error object #82

@TimDaub

Description

@TimDaub
  • From what I understand, if a task throws during execution, that error is propagated as a valid JavaScript Error object and so it can be used in
q.on('task_failed', function (taskId, err, stats) {
  // Handle error, stats = { elapsed: <time taken> }
})

e.g., within the task_failed handler, I could call err.toString() - and I have been doing that.
However, the emitted error in maxTimeout is just a string and so this assumption is broken:

worker.failedBatch('task_timeout');

Suddenly, when I call err.toString() my script crashes as toString isn't a member of a String object. Hence, I believe the maxTimeout handling should at least emit an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions