-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add exception handler for invalid schedule in make_action_from_post() #292
Conversation
@rrennick this looks good and looks like it will mitigate the issue. Just to point out though @JPry was talking about logging these somewhere, and noted that there are try/catches in place in other places which call this method. However, I found a few which don't. So the choice seems to be try/catch here, or try/catch higher up when fetching these jobs. |
I think it would be good to log it in the scheduled action log in addition to adding it to an error log. In that case, it should be done above the data store so it's logged regardless of the data store being used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rrennick This does indeed solve the problem of catching the exception, but it leaves this problem failing silently. I think we should add an action inside the catch block that ActionScheduler_FatalErrorMonitor
(or other code) can tie into.
@JPry Thanks, I added the hook and an action to the base logger class to log to the action that it failed to fetch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This PR adds an exception handler for the WP post store retrieving the schedule from the post content. It's possible for the post content to be json_encoded and not an array.
@mikejolley Can you take a look at this as well?