Skip to content

Commit

Permalink
Log offload errors into log module
Browse files Browse the repository at this point in the history
  • Loading branch information
av3nger committed Nov 10, 2023
1 parent 26fb14a commit 3c3d091
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/class-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public function set_error( $code = '', string $message = '' ) {
if ( '' === $code ) {
self::$error = false;
} else {
do_action( 'cf_images_log', $message );
self::$error = new WP_Error( $code, $message );
}
}
Expand Down
7 changes: 2 additions & 5 deletions app/class-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,8 @@ public function ajax_bulk_process() {
'stats' => $this->get_stats(),
);

if ( is_wp_error( Core::get_error() ) ) {
$response['error'] = Core::get_error()->get_error_message();
}

do_action( 'cf_images_error', 0, '' ); // Reset the error.
// Eventually we should move all errors into the log module, for now - just reset the error.
do_action( 'cf_images_error', 0, '' );

wp_send_json_success( $response );
}
Expand Down

0 comments on commit 3c3d091

Please sign in to comment.