Skip to content

Commit

Permalink
enhanced the cron error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed Nov 8, 2024
1 parent 6a480f7 commit 3dd5e72
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/cron.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as handler from "@ghom/handler"

import discord from "discord.js"
import cron from "node-cron"
import path from "path"
import url from "url"
import discord from "discord.js"

import * as util from "./util.ts"

Expand Down Expand Up @@ -194,6 +194,9 @@ export function cronKeyToPattern(key: CronIntervalKey): string {
}

export function cronSimpleToPattern(simple: CronIntervalSimple): string {
if (!simple.duration || simple.duration < 0)
throw new CRON_Error("Invalid cron's schedule duration")

switch (simple.type) {
case "minute":
return `*/${simple.duration} * * * *`
Expand Down

0 comments on commit 3dd5e72

Please sign in to comment.