Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant Pinterest API error handlers #1087

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions class-pinterest-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@ public function init_plugin() {

add_action( 'pinterest_for_woocommerce_disconnect', array( self::class, 'reset_connection' ) );

add_action( 'action_scheduler_failed_execution', array( self::class, 'action_scheduler_reset_connection' ), 10, 2 );

// Handle the Pinterest verification URL.
add_action( 'parse_request', array( $this, 'verification_request' ) );

Expand Down Expand Up @@ -847,25 +845,6 @@ public static function reset_connection() {
TokenInvalidFailure::possibly_add_note();
}

/**
* Resets the connection from action scheduler.
*
* @since 1.4.4
*
* @param string $action_id The ID of the action.
* @param Exception $e The exception that was thrown.
*
* @return void
* @throws NotesUnavailableException If the notes API is not available.
* @throws Exception If the exception is a 401 error.
*/
public static function action_scheduler_reset_connection( $action_id, $e ) {
if ( in_array( $e->getCode(), array( 401, 403 ) ) ) {
self::reset_connection();
throw $e;
}
}

/**
* Flush data option and remove settings.
*
Expand Down
7 changes: 0 additions & 7 deletions tests/Unit/PinterestForWoocommerceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ public function test_disconnect_events_added_with_plugin() {
[ Pinterest_For_Woocommerce::class, 'reset_connection' ]
)
);
$this->assertEquals(
10,
has_action(
'action_scheduler_failed_execution',
[ Pinterest_For_Woocommerce::class, 'action_scheduler_reset_connection' ]
)
);
}

/**
Expand Down
Loading