From b78fd0f4f4d7423cf6829ab52be9ad26ae6b8fb1 Mon Sep 17 00:00:00 2001 From: HerrHase Date: Fri, 3 May 2024 12:17:06 +0200 Subject: [PATCH] small bugfix, adding catch for main run --- packages/runner/index.ts | 8 ++++++-- packages/runner/single.ts | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/runner/index.ts b/packages/runner/index.ts index 2df926a..588ba99 100644 --- a/packages/runner/index.ts +++ b/packages/runner/index.ts @@ -23,7 +23,7 @@ if (configs.length === 0) { } // running through configs -for (const config in configs) +for (const config in configs) { // check for cron if (!config.hasOwnProperty('cron')) { @@ -35,6 +35,10 @@ for (const config in configs) * */ const task = cron.schedule(config.cron, async() => { - const docket = await run(config, docket) + try { + const docket = await run(config, docket) + } catch(error) { + logger(config.slug).error(error) + } }) } diff --git a/packages/runner/single.ts b/packages/runner/single.ts index 3a3a210..af393db 100644 --- a/packages/runner/single.ts +++ b/packages/runner/single.ts @@ -32,4 +32,9 @@ if (configs.length === 0) { } const config = configs[0] -const docket = await run(config) + +try { + const docket = await run(config) +} catch(error) { + logger(config.slug).error(error) +}