Skip to content

Commit ab77686

Browse files
docs: update task-scheduling page to mention auto try-catch wrap
1 parent e69dc67 commit ab77686

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

content/techniques/task-scheduling.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class TasksService {
116116
}
117117
```
118118

119-
In this example, the `handleCron()` method will be called every `30` seconds.
119+
In this example, the `handleCron()` method will be called every `30` seconds. If an exception occurs, it will be logged to the console, as every method annotated with `@Cron()` is automatically wrapped in a `try-catch` block.
120120

121121
Alternatively, you can supply a JavaScript `Date` object to the `@Cron()` decorator. Doing so causes the job to execute exactly once, at the specified date.
122122

@@ -189,6 +189,8 @@ If you want to control your declarative interval from outside the declaring clas
189189
handleInterval() {}
190190
```
191191

192+
If an exception occurs, it will be logged to the console, as every method annotated with `@Interval()` is automatically wrapped in a `try-catch` block.
193+
192194
The <a href="techniques/task-scheduling#dynamic-intervals">Dynamic API</a> also enables **creating** dynamic intervals, where the interval's properties are defined at runtime, and **listing and deleting** them.
193195

194196
<app-banner-enterprise></app-banner-enterprise>
@@ -206,6 +208,8 @@ handleTimeout() {
206208

207209
> info **Hint** This mechanism uses the JavaScript `setTimeout()` function under the hood.
208210
211+
If an exception occurs, it will be logged to the console, as every method annotated with `@Timeout()` is automatically wrapped in a `try-catch` block.
212+
209213
If you want to control your declarative timeout from outside the declaring class via the <a href="/techniques/task-scheduling#dynamic-schedule-module-api">Dynamic API</a>, associate the timeout with a name using the following construction:
210214

211215
```typescript

0 commit comments

Comments
 (0)