[wp-trac] [WordPress Trac] #34551: Change API error response to focus on singular errors
WordPress Trac
noreply at wordpress.org
Mon Nov 2 03:43:03 UTC 2015
#34551: Change API error response to focus on singular errors
-------------------------+--------------------------
Reporter: rmccue | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.4
Component: REST API | Version: trunk
Severity: normal | Keywords: dev-feedback
Focuses: |
-------------------------+--------------------------
(Migrating https://github.com/WP-API/WP-API/issues/1473 here.)
Basically: right now, the API returns a list of objects on error:
{{{
[
{
"code": "rest_no_route",
"message": "No route was found matching the URL and request
method",
"data": {
"status": 404
}
}
]
}}}
This is because under the hood, `WP_Error` holds multiple errors. Most
people don't use this functionality at all, and this complicates error
handling on the client site.
This is p late, but still early enough to change this IMO. Needs sign-off
though, since it's technically a BC break, and it cuts out some potential
use cases of `WP_Error`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34551>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list