Sync your WordPress posts to standard.site records on your PDS
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

better handling of refresh errors

+13 -2
+13 -2
includes/ConnectionsManager.php
··· 384 384 return $response; 385 385 } 386 386 387 + $status_code = wp_remote_retrieve_response_code($response); 387 388 $body = json_decode(wp_remote_retrieve_body($response), true); 388 389 389 - if (empty($body["access_token"])) { 390 + if ($status_code >= 400 || empty($body["access_token"])) { 391 + // Clear the stale connection so the user can reconnect. 392 + delete_option("wireservice_connection"); 393 + 394 + $error_message = $body["error_description"] 395 + ?? ($body["error"] ?? __("Token refresh failed.", "wireservice")); 396 + 390 397 return new \WP_Error( 391 398 "refresh_failed", 392 - __("Token refresh failed.", "wireservice"), 399 + sprintf( 400 + /* translators: %s: error detail from the server */ 401 + __("Session expired: %s. Please reconnect your account.", "wireservice"), 402 + $error_message, 403 + ), 393 404 ); 394 405 } 395 406