wp-rocket
wp-rocket copied to clipboard
Catch Action Scheduler exceptions
Action Scheduler functions to enqueue or schedule action can throw exceptions when an error happens. Exceptions are going to create fatal errors on website if not caught. We have seen this happen when the tables were missing for example.
We added guards to recreate the tables when they are missing, but there is other cases where exceptions could be thrown, so we should guard against them wherever we use AS functions, with the use of try/catch clauses.