mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fixed errors thrown in CRON hook not caught (#8193)
This commit is contained in:
@@ -173,7 +173,13 @@ function registerHooks(hooks: Extension[]) {
|
||||
if (!cron || validate(cron) === false) {
|
||||
logger.warn(`Couldn't register cron hook. Provided cron is invalid: ${cron}`);
|
||||
} else {
|
||||
schedule(cron, handler);
|
||||
schedule(cron, async () => {
|
||||
try {
|
||||
await handler();
|
||||
} catch (error: any) {
|
||||
logger.error(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
emitter.on(event, handler);
|
||||
|
||||
Reference in New Issue
Block a user