crunz icon indicating copy to clipboard operation
crunz copied to clipboard

Add checking "is format of expression valid"

Open engor opened this issue 5 years ago • 3 comments

Faced out problem when did mistake in weeklyOn() method, just forgot to specify $day param: ->weeklyOn('11:25'). Such call was converted to 0 0 * * 11:25 and it's invalid format.

And as a result all tasks after this didn't work at all! And there were no visible errors, it stop somewhere under the hood of cron (I guess).

Would be very useful to have auto-check of cron expression and trigger error if there is a problem and don't run problematic task.

Thanks. :)

engor avatar Jan 16 '20 03:01 engor

Hello, all i can do now is to show deprecation notice in v2.1 and throw exception in v3.0 in case someone passes wrong Cron expression. WDYT?

PabloKowalczyk avatar Jan 18 '20 07:01 PabloKowalczyk

Exception in v3.0 sounds cool! :) Sorry for long reaction, I missed your answer.

engor avatar Feb 23 '20 16:02 engor

Actually, I've tested it and proper exception [InvalidArgumentException] Invalid CRON field value 11:25 at position 4 is shown, what version of Crunz do you use?

PabloKowalczyk avatar Jun 18 '20 05:06 PabloKowalczyk