From 9990deec17f4c09fe25a30d416147160f13955a9 Mon Sep 17 00:00:00 2001 From: James Allan Date: Thu, 9 May 2024 13:06:31 +1000 Subject: [PATCH 1/2] Throw error exception when a error occurs during action processing --- classes/abstracts/ActionScheduler_Abstract_QueueRunner.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php b/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php index 673499fca..f4fecc932 100644 --- a/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php +++ b/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php @@ -58,9 +58,11 @@ public function process_action( $action_id, $context = '' ) { * * @param int $type Error level expressed as an integer. * @param string $message Error message. + * @param string $file File in which the error occurred. + * @param int $line Line number at which the error occurred. */ - function ( $type, $message ) { - throw new Exception( $message ); + function ( $type, $message, $file, $line ) { + throw new ErrorException( $message, 0, $type, $file, $line ); }, E_USER_ERROR | E_RECOVERABLE_ERROR ); From d1cac98a71245c208e7b921b29e4210d51f3eab2 Mon Sep 17 00:00:00 2001 From: James Allan Date: Thu, 9 May 2024 13:06:42 +1000 Subject: [PATCH 2/2] Fix typos --- classes/abstracts/ActionScheduler_Abstract_QueueRunner.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php b/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php index f4fecc932..0f781aa58 100644 --- a/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php +++ b/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php @@ -44,14 +44,14 @@ public function __construct( ActionScheduler_Store $store = null, ActionSchedule * Process an individual action. * * @param int $action_id The action ID to process. - * @param string $context Optional identifer for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' + * @param string $context Optional identifier for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' * Generally, this should be capitalised and not localised as it's a proper noun. */ public function process_action( $action_id, $context = '' ) { // Temporarily override the error handler while we process the current action. set_error_handler( /** - * Temporary error handler which can catch errors and convert them into exceptions. This faciliates more + * Temporary error handler which can catch errors and convert them into exceptions. This facilitates more * robust error handling across all supported PHP versions. * * @throws Exception