[wp-trac] [WordPress Trac] #35425: Return HTTP status code in WP_Error objects
WordPress Trac
noreply at wordpress.org
Tue Jan 12 20:04:36 UTC 2016
#35425: Return HTTP status code in WP_Error objects
-----------------------------+----------------------------
Reporter: danielbachhuber | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
-----------------------------+----------------------------
The REST API has an existing pattern of using a HTTP status code to better
describe the nature of a `WP_Error` object:
{{{
if ( ! empty( $request['id'] ) ) {
return new WP_Error( 'rest_post_exists', __( 'Cannot create
existing post.' ), array( 'status' => 400 ) );
}
}}}
Throughout WordPress, it would improve the quality of error reporting to
include an equivalent HTTP status when generating a new `WP_Error` object.
This ticket can serve as placeholder for improvements to this effect.
Previously: https://github.com/WP-API/WP-
API/issues/153#issuecomment-170734687
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35425>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list