Skip to content

Extend error handling for ability schema validation #14

@gziolo

Description

@gziolo

Follow-up for:

REST API needs detailed error messages with HTTP status codes. While WP_Ability::execute() validates internally, it only returns false and logs with _doing_it_wrong(), which doesn't provide capturable error messages. Related code that handles it today:

https://github.com/WordPress/abilities-api/blob/trunk/includes/rest-api/endpoints/class-wp-rest-abilities-run-controller.php#L137L144

https://github.com/WordPress/abilities-api/blob/dd94fce1a6ba8930d39f2011fa1e6147f9759ad8/includes/rest-api/endpoints/class-wp-rest-abilities-run-controller.php#L164L169

Consider updating WP_Ability to return WP_Error for better error handling which would then simplify and unify the implementation in REST API controller.

Metadata

Metadata

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions