Skip to content

Commit

Permalink
fix(content-distribution): handle incoming post object error (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelpeixe authored Feb 26, 2025
1 parent 88df0d1 commit b83b8f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion includes/incoming-events/class-network-post-deleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ protected function process_post_deleted() {
Debugger::log( 'Error processing network_post_deleted: ' . $error->get_error_message() );
return;
}
$incoming_post = new Incoming_Post( $payload );

try {
$incoming_post = new Incoming_Post( $payload );
} catch ( \Exception $e ) {
Debugger::log( 'Error processing network_post_deleted: ' . $e->getMessage() );
return;
}

$incoming_post->delete();
}
}
9 changes: 8 additions & 1 deletion includes/incoming-events/class-network-post-updated.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ protected function process_post_updated() {
Debugger::log( 'Error processing network_post_updated: ' . $error->get_error_message() );
return;
}
$incoming_post = new Incoming_Post( $payload );

try {
$incoming_post = new Incoming_Post( $payload );
} catch ( \Exception $e ) {
Debugger::log( 'Error processing network_post_updated: ' . $e->getMessage() );
return;
}

$post_id = $incoming_post->insert();

if ( ! is_wp_error( $post_id ) ) {
Expand Down

0 comments on commit b83b8f2

Please sign in to comment.