Skip to content

Commit 07085d8

Browse files
committed
fix: improve error message handling
1 parent 4dcb611 commit 07085d8

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

includes/data-events/class-data-events.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ public static function register_handler( $handler, $action_name = null ) {
443443
sprintf(
444444
'ATTENTION: Data Event handler for action "%s" was not properly registered: %s',
445445
$action_name,
446-
$error->get_error_message()
446+
implode( '; ', $error->get_error_messages() )
447447
)
448448
);
449449

@@ -590,7 +590,7 @@ public static function dispatch( $action_name, $data, $use_client_id = true ) {
590590
$body = apply_filters( 'newspack_data_events_dispatch_body', $body, $action_name );
591591

592592
if ( is_wp_error( $body ) ) {
593-
self::log( sprintf( 'Error dispatching action "%s": %s', $action_name, $body->get_error_message() ) );
593+
self::log( sprintf( 'Error dispatching action "%s": %s', $action_name, implode( '; ', $body->get_error_messages() ) ) );
594594
return $body;
595595
}
596596

includes/reader-activation/sync/class-contact-sync.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,17 @@ public static function execute_integration_retry( $retry_data ) {
279279
$retry_count,
280280
$integration_id,
281281
$contact['email'] ?? 'unknown',
282-
$result->get_error_message()
282+
implode( '; ', $result->get_error_messages() )
283283
)
284284
);
285-
self::schedule_integration_retry( $integration_id, $contact, $context, $existing_contact, $retry_count, $result->get_error_message() );
285+
self::schedule_integration_retry(
286+
$integration_id,
287+
$contact,
288+
$context,
289+
$existing_contact,
290+
$retry_count,
291+
implode( '; ', $result->get_error_messages() )
292+
);
286293
return;
287294
}
288295

0 commit comments

Comments
 (0)