[wp-trac] [WordPress Trac] #35425: Return HTTP status code in WP_Error objects
WordPress Trac
noreply at wordpress.org
Tue Jan 19 11:44:42 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 rmccue):
Replying to [comment:8 danielbachhuber]:
> Can you clarify what the alternative should be? I thought changing the
data included in `WP_Error` objects was the original intent.
If the error object already has data, we can't change that (unless it's an
assoc array we can just add a key to), since plugins may be relying on
accessing that data as-is. For errors without data attached, we can add
it, since plugins can't be relying on something that's not there.
(Technically they could be relying on it being empty, but I doubt anyone
ever does that.)
Replying to [comment:9 dd32]:
> 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()`.
I think at that point, we'd be better off just adding a separate `status`
property. Incidentally, I'm fine with that, but we'd need to keep BC for
having it in data anyway, so I don't think it's worth the cruft.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35425#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list