[wp-trac] [WordPress Trac] #28319: Add hook to WP_Error for logging and report purposes

WordPress Trac noreply at wordpress.org
Mon Nov 24 07:10:04 UTC 2014


#28319: Add hook to WP_Error for logging and report purposes
-----------------------------------+-----------------------------
 Reporter:  ebinnion               |       Owner:  johnbillion
     Type:  enhancement            |      Status:  reopened
 Priority:  normal                 |   Milestone:  Future Release
Component:  General                |     Version:  4.0
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |     Focuses:
-----------------------------------+-----------------------------

Comment (by rmccue):

 Replying to [comment:23 carlalexander]:
 > > The REST API will make pretty liberal use of WP_Error (intentionally),
 and logging all of those alone would be problematic.
 >
 > I use WP_Errors a lot with the custom work I do with the API. It's
 great, but the API once rolled out will highlight this issue more. Anyone
 building an API based app will need to know what's going on their server.
 WordPress won't be able to handle errors in the same way anymore.

 My point was more that it could be totally intentional to have multiple
 `WP_Error`s created in a single call to WP. In some of the services I
 maintain, an individual request might have 20 error objects created as-is,
 it's no different to returning `false` or `null` from a callback (except
 that you can have extra data). We don't log every time we return null.

 > You could collect them during the whole execution and write everything
 out after the WordPress has terminated on the shutdown hook. There's
 definitely ways to minimize the impact otherwise people wouldn't use
 logging.

 My reasoning was unclear here; I meant if we ever added actual logging for
 this by default.

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


More information about the wp-trac mailing list