-
Notifications
You must be signed in to change notification settings - Fork 625
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
error handling #426
Comments
This is important. If an error is thrown by a async function inside the cronjob callback.. then even with a try.. catch I will get
|
Currently there isn't a way. But, I do see value in this. If I get some time I'll implement this, otherwise I'd happily review a PR for this. Thanks for bringing it up. |
Any updates on this? |
any update on this? |
This would be VERY handy.... +1 |
The palliative solution I found was to retrieve the CronJob callback list ( var job = new CronJob(/* parameters for the constructor */);
/* In practice you will only have one spawn to execute at each tick */
job._callbacks.forEach((spawn) => {
spawn.on('error', (err) => {
console.error('Failed to start subprocess.');
});
}); You can do the same gambling on I am not proud to share this tip, but as long as there is no other solution, it goes anyway. |
What is the status of this feature? I noticed throwing an exception from the callback function given to cron.schedule will not terminate the overall process, but it just keeps executing. Does the node cron module apply a try catch under the hood or how can this behavior be explained? |
this feature's scope seems simple and well-defined enough:
|
Hello.
Is there a way to catch an error during the cronjob execution? As I see cron.start() doesn't return promise, so we can't just hang a .catch() there.
I guess it's common need so some people found a good approach to solve it.
Thank you a lot!
Feature specification: #426 (comment)
The text was updated successfully, but these errors were encountered: