nestjs/schedule

Exceptions not handled in cronjob functions added via SchedulerRegistry

simon1389 opened this issue · 3 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When adding a cronjob by using the SchedulerRegistry, exceptions occuring inside the cron-function are not handled and cause the app to exit.
In a previous commit this behavior was fixed when using the @Cron annotation (0cdfe8f)

Minimum reproduction code

https://github.com/simon1389/nestjs-schedule-bug

Steps to reproduce

  1. npm start
  2. See the error on console and the application shutdown

Expected behavior

I expect the same behavior as when using the @Cron syntax.
So the error should be catched.

Package version

2.1.0

NestJS version

9.0.0

Node.js version

16.17.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Would you like to create a PR for this issue?

PR opened 😃

Let's track this here #1084