From c68f98b18a987c1c0ee5d983177ba227a14db93d Mon Sep 17 00:00:00 2001 From: Dharmesh Patel Date: Fri, 14 Jul 2023 20:10:10 +0530 Subject: [PATCH] Provider Error message from Twitter if it is available. --- includes/class-twitter-api.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/includes/class-twitter-api.php b/includes/class-twitter-api.php index f1e91fba..68b9eaa0 100644 --- a/includes/class-twitter-api.php +++ b/includes/class-twitter-api.php @@ -44,13 +44,6 @@ class Twitter_API { */ protected $access_token_secret; - /** - * The twitter handle. - * - * @var string The twitter handle. - */ - protected $twitter_handle; - /** * The TwitterOAuth client. * @@ -172,6 +165,9 @@ public function get_current_account() { ); if ( ! $user || ! isset( $user->data ) || ! isset( $user->data->id ) ) { + if ( ! empty( $user->detail ) ) { + return new \WP_Error( 'error_get_twitter_user', $user->detail ); + } return new \WP_Error( 'error_get_twitter_user', __( 'Something went wrong during getting user details', 'autoshare-for-twitter' ) ); }