Open gin0115 opened 2 months ago
/views/cli-error.php
<?php $stack_trace = explode( "\n", $error['message'] ); // Extract main error message $subheader = array_shift( $stack_trace ); ?> ************************************************************ <?php echo "\n"; ?> CLI ERROR: <?php echo ( $message['response'] ); ?> <?php echo "\n"; ?> ************************************************************ <?php echo "\n"; ?> <?php echo ( $subheader ); ?> <?php echo "\n"; ?> ************************************************************<?php echo "\n"; ?> File: <?php echo "{$error['file']} on line {$error['line']}"; ?><?php echo "\n"; ?> ************************************************************<?php echo "\n"; ?>
add_filter(
'wp_php_error_args',
function ( $message, $error ) {
if ( wp_doing_ajax() || pinkcrab_is_rest() ) {
include 'views/ajax-error.php';
} elseif ( defined( 'WP_CLI' ) && WP_CLI ) {
include 'views/cli-error.php';
} else {
include 'views/wp-error.php';
}
},
2,
10
);
The error log should be better for wpcli