[wp-trac] [WordPress Trac] #34551: Change API error response to focus on singular errors

WordPress Trac noreply at wordpress.org
Mon Nov 2 04:07:39 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                  |  Resolution:
 Keywords:  dev-feedback has-patch  |     Focuses:
------------------------------------+--------------------
Changes (by rmccue):

 * keywords:  dev-feedback => dev-feedback has-patch


Comment:

 Replying to [comment:1 dd32]:
 > I'd almost expect it to return the "primary" error object, with any
 additional errors available in an extra sub-key

 Agreed, it's a bit non-obvious there.

 > An example use-case for where multiple errors are returned would
 significantly help in deciding if we do need to retain this though.

 There's a few potential cases for this. One of the key ones might be
 multiple validation errors, so e.g. you're trying to create a post, but a)
 you're not authorised, and b) you sent an invalid post date.

 Attached [attachment:34551.diff] as an initial patch at this.

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


More information about the wp-trac mailing list