diff --git a/CHANGELOG.md b/CHANGELOG.md index 4786ee55..076225e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Unreleased + +- Call `redis_object_cache_error` action before `wp_die()` + ## 2.4.4 - Improved handling of unexpected transaction results diff --git a/includes/object-cache.php b/includes/object-cache.php index f136a8f1..aa0c229a 100644 --- a/includes/object-cache.php +++ b/includes/object-cache.php @@ -2875,21 +2875,22 @@ protected function handle_exception( $exception ) { error_log( $exception ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log - if ( ! $this->fail_gracefully ) { - $this->show_error_and_die( $exception ); - } - - $this->errors[] = $exception->getMessage(); - if ( function_exists( 'do_action' ) ) { /** - * Fires on every cache error + * Fires when an object cache related error occurs. * * @since 1.5.0 - * @param \Exception $exception The exception triggered. + * @param \Exception $exception The exception. + * @param string $message The exception message. */ - do_action( 'redis_object_cache_error', $exception ); + do_action( 'redis_object_cache_error', $exception, $exception->getMessage() ); } + + if ( ! $this->fail_gracefully ) { + $this->show_error_and_die( $exception ); + } + + $this->errors[] = $exception->getMessage(); } /**