Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #60014, comment 6


Ignore:
Timestamp:
12/07/2023 10:59:47 AM (23 months ago)
Author:
ecc
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #60014, comment 6

    initial v1  
    33But i think, for the "server errors" output feature, checking WP_DEBUG and WP_DEBUG_DISPLAY maybe enough already.
    44
    5 {{{#!php
    6 <?php
    7 if(
    8   defined('WP_DEBUG') && WP_DEBUG === true &&
    9   defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY === true
    10 ) {
    11   // Add current error / exception message to the JSON response.
    12 }
    13 }}}
    14 
    15 output:
    16 
    17 
    18 {{{
    19 {
    20     "code": "internal_server_error",
    21     "message": "<p>There has been a critical error on this website.<\/p>",
    22     "data": {
    23         "status": 500,
    24         "error": "Uncaught TypeError: PluginConfig::getWpOptionStorageName(): Return value must be of type array, string returned in ..."
    25     },
    26     "additional_errors": []
    27 }
    28 }}}
    29 
    30 
     5Edit: Posted and implementation example in the reply.