Skip to content

Commit

Permalink
Provider Error message from Twitter if it is available.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdharmesh committed Jul 14, 2023
1 parent 867a243 commit c68f98b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions includes/class-twitter-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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' ) );
}

Expand Down

0 comments on commit c68f98b

Please sign in to comment.