From a3d10a982f2fefe755f5f2fa2cad4440a590c52c Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Tue, 20 Aug 2024 18:26:47 +0530 Subject: [PATCH] Make the API authentication error message more general. --- lib/mailchimp/mailchimp.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mailchimp/mailchimp.php b/lib/mailchimp/mailchimp.php index 39861b5..e3bb099 100644 --- a/lib/mailchimp/mailchimp.php +++ b/lib/mailchimp/mailchimp.php @@ -128,6 +128,7 @@ public function get( $endpoint, $count = 10, $fields = array() ) { // Check if Access Token is invalid/revoked. if ( in_array( $request['response']['code'], array( 401, 403 ), true ) ) { update_option( 'mailchimp_sf_auth_error', true ); + return new WP_Error( 'mailchimp-auth-error', esc_html__( 'Authentication failed.', 'mailchimp' ) ); } $error = json_decode( $request['body'], true );