You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As pointed out in referenced issue there is no error detection logic in later.parse.cron function. This introduced an inconsistency with how later.parse.text behave when invalid values are passed in. In case of cron method there is no indication of any type of error if completely invalid string is passed in. Contrary for text method there's error property assigned to returned object when the expression is not parsed.
Possible solution
There are multiple ways I can see this issue can be approached:
Leave it as is, but be very specific that making sure the cron expression is valid is on the client
Validate cron expression internally and return consistent error just like in case of parsing expression through text function
Personally I'm in favor of second approach as that would allow to unify error handling.
The text was updated successfully, but these errors were encountered:
To move on with the implementation I've ended up using cron-parser to validate cron expressions before calling later.parse.cron. Might serve as a good reference for parsing logic
If the validation for cron expressions is moved into later's layer, I think it will make the logic for both cron and text expressions-to-schedule transformations more consistent.
Just noticed the same issue. Would make sense to use same as for text parser as right now cron gives me 0 for error all the time and that complicates everything.
refs bunkat/later#174
Problem
As pointed out in referenced issue there is no error detection logic in later.parse.cron function. This introduced an inconsistency with how later.parse.text behave when invalid values are passed in. In case of
cron
method there is no indication of any type of error if completely invalid string is passed in. Contrary fortext
method there'serror
property assigned to returned object when the expression is not parsed.Possible solution
There are multiple ways I can see this issue can be approached:
text
functionPersonally I'm in favor of second approach as that would allow to unify error handling.
The text was updated successfully, but these errors were encountered: