[wp-trac] [WordPress Trac] #38777: Add method to merge one WP_Error into another

WordPress Trac noreply at wordpress.org
Thu Jul 2 18:20:51 UTC 2020


#38777: Add method to merge one WP_Error into another
--------------------------------------+-----------------------
 Reporter:  rmccue                    |       Owner:  dlh
     Type:  feature request           |      Status:  assigned
 Priority:  normal                    |   Milestone:  5.5
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+-----------------------

Comment (by TimothyBlynJacobs):

 From the REST API perspective, I think it would be most helpful if we
 could merge the error data somehow.

 Perhaps if both error datas are an array, merge them? With the `$from`
 error taking precedence?

 Alternately, perhaps we could try actually supporting having multiple data
 entries for each error code? Perhaps with an `additional_data` property?

 Something to keep in mind is that the REST API uses a `status` key in the
 error data to set the response status code.

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


More information about the wp-trac mailing list