Migrate all ability error returns to WP_Error, fix broken chat tools#107
Merged
Conversation
…_exists guards
Ability providers (35 files):
- Convert all 'success' => false returns to WP_Error across 8 platforms
(Instagram, Pinterest, Facebook, Twitter, Bluesky, Threads, LinkedIn, Reddit)
- Update return type hints to array|\WP_Error
- Standardized error codes: missing_param (400), missing_auth (401),
not_found (404), api_error (500), invalid_action (400)
Chat tools (35 files):
- Fix 13 broken chat tools that used undefined $ability variable
(Read/Update for Twitter, Facebook, Bluesky, Threads, Pinterest)
- Remove all function_exists('wp_get_ability') guards
- Update error handling to check is_wp_error() before $result['success']
CLI commands (9 files):
- Remove 34 function_exists guard blocks
- Update $result['success'] checks to handle WP_Error
RestApi.php:
- Remove 8 function_exists ternary guards
- Add WP_Error-to-array conversion for REST responses
Refs Extra-Chill/data-machine#999, #105
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The largest PR in this series — migrates all 43 ability callbacks across 8 social platforms from
['success' => false, ...]toWP_Errorreturns, per data-machine#999.Ability providers (35 files, 293 error returns converted)
Bug fixes
$abilityvariable — would fatal at runtime. Now properly callwp_get_ability().function_existsguards (now removed per contract — abilities are always available)Consumer updates (45 files)
function_exists('wp_get_ability')guards removed across CLI commands (34), RestApi (8), chat tools (15)is_wp_error()patternWP_Error-to-array conversion for REST responses80 files changed, -972 lines net.
Refs Extra-Chill/data-machine#999
Closes #105