Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TimDaub opened this issue Jun 29, 2022 · 0 comments

Comments

@TimDaub
Copy link
Contributor

TimDaub commented Jun 29, 2022

  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant