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
Fix 104 improve error handling #105
Conversation
Shouldn't the errors be emitted instead of logged, allowing end-users to catch them and act accordingly? Something like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better as suggested in the comments to emit the errors instead of just logging them out
Hi guys, yes I think suggested change is a good idea, but I'm not completely understand how to create an event listener for these errors. |
@stansv are you sure about that? emitting an error thrown by a promise should avoid the warning you are mentioning. |
(as I noted previously event name must be I feel I missing something about promises.. |
Could be |
No, I've found the reason —
|
@manast thanks for approval, but I cannot agree with current behavior, namely with
— if emit is called then first arg must be event name, not arbitrary error object; I do not understand how this might work (@dirkgroenen maybe you can help). How about this?
|
You're right @stansv , I think I made a typo and was supposed to write / My two cents; you might want to consider logging the error with an additional message informing about the missing error handler? |
Going to close this PR as master has drifted too much away from this branch and it is not easy to merge anymore. |
…-connection * 'master' of github.com:taskforcesh/bullmq: (46 commits) GitBook: [taskforcesh#106] No subject docs(metrics): fix typo GitBook: [taskforcesh#105] No subject chore(release): 1.78.1 [skip ci] fix(queue): close repeat connection when calling close (taskforcesh#1154) chore(release): 1.78.0 [skip ci] feat(cron-parser): upgrades version to 4.2.1 (taskforcesh#1149) fixes taskforcesh#1147 test(events): fix flaky test chore(release): 1.77.3 [skip ci] fix(async-send): check proc.send type (taskforcesh#1150) test(rate-limiter): fix flaky test chore(release): 1.77.2 [skip ci] perf(clean): speed up clean operation using deletion marker (taskforcesh#1144) fix(trim-events): consider maxLenEvents as 0 (taskforcesh#1137) chore(release): 1.77.1 [skip ci] fix(flow): remove processed children (taskforcesh#1060) fixes taskforcesh#1056 chore(release): 1.77.0 [skip ci] feat: allow QueueScheduler to be extended chore(release): 1.76.6 [skip ci] fix(master): do not export master file (taskforcesh#1136) fixes taskforcesh#1125 ref taskforcesh#1129 ...
Fixed some cases when UnhandlerPromiseRejectionWarning's can appear, the simplest solution is to do console.log to handle rejections. Emitting
error
events in catch() sections would also produce UnhandlerPromiseRejectionWarning (it was surprising for me). Probably it'd be better to modify instance state (write error details into some field) and make all its methods non-functional by re-throwing that error in each call, but this is not very suitable for worker which can be used without calling any instance methods.Also I've moved array of worker tokens to worker class field level, this can be helpful for monitoring.
Fixes #104