nestjs / schedule

Schedule module for Nest framework (node.js) ⏰

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Add a schedule task annotation that can throw errors

zanyatta opened this issue · comments

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

SetTimeout() is used at the bottom of the current scheduled task. If an error occurs in the scheduled task, it will not be thrown out of the method.

Expected behavior

Add a schedule annotation, try-catch by default, throw exceptions to the Nest framework.

What is the motivation / use case for changing the behavior?

We have implemented global handling of exceptions on Nest, but we found that exceptions in schedule will not be thrown. At present, we have to wrap all schedule codes with try-catch and do some things in catch. This Not the way we want.

This has been discussed in the past. We don't plan to introduce new annotations just to handle exceptions. For this, please use try..catch blocks.

Please, use our Discord channel (support) for further questions.