[wp-trac] [WordPress Trac] #46252: Enhance Error Message for Meta Fields

WordPress Trac noreply at wordpress.org
Thu Feb 14 11:40:24 UTC 2019


#46252: Enhance Error Message for Meta Fields
-------------------------+-----------------------------
 Reporter:  apermo       |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:  trunk
 Severity:  minor        |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/fields/class-wp-rest-meta-fields.php#L270

 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/fields/class-wp-rest-meta-fields.php#L283

 https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-
 api/fields/class-wp-rest-meta-fields.php#L333

 {{{#!php
 <?php
 return new WP_Error(
    'rest_meta_database_error',
    __( 'Could not update meta value in database.' ),
    array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR )
 );
 ?>
 }}}


 These 3 Error messages are actually not helpful, if you submit multiple
 meta fields, you don't know (at least not on the remote site) which meta
 was throwing the error.

 It would be more helpful/self explaining if the error message was more
 like:

 {{{
 sprintf( __( 'Could not update the meta value "%s" in database.' ),
 $meta_key ),
 }}}

 this way you could directly tell which meta field is throwing the error.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46252>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list