[wp-trac] [WordPress Trac] #35425: Return HTTP status code in WP_Error objects

WordPress Trac noreply at wordpress.org
Tue Jan 19 02:54:56 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           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+-----------------------------

Comment (by dd32):

 Altering the data returned by existing `WP_Error`s is going to be a no-go.

 Potentially it could be "upgraded" to accept `array( 'status' => 404,
 'data' => ... )` and return the data element as the `get_error_data()` and
 status via `get_error_type()` / `get_error_status()`.

 This will need some clear cut explanations of what HTTP code represents
 what as well, for example, a `404` being returned on download failure (as
 in the patch above) is the closest to what was actually encountered, but
 probably isn't what should be returned to the Browser or REST client (but
 it might be?).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35425#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list