Skip to content

Commit

Permalink
See pewresearch/pewresearch-org@5132e30 from refs/heads/release/5.0-u…
Browse files Browse the repository at this point in the history
…rl-rewrites
  • Loading branch information
prcdevgitbot committed Mar 6, 2024
1 parent 6fa8e6d commit 4435fcc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 11 additions & 1 deletion includes/interactives/blocks/loader-block/loader-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ public function render_interactive_loader_callback($attributes, $content, $block
$enqueued_handles = array();
if ( $is_legacy_wpackio ) {
wp_enqueue_script('firebase');
$enqueued_handles = $this->load_legacy_wpackIO($attributes['legacyWpackIo']);
// try to load the legacy wpackio, and if it fails, then log the error and return empty string.
try {
$enqueued_handles = $this->load_legacy_wpackIO($attributes['legacyWpackIo']['appName']);
} catch ( \Exception $e ) {
if ( function_exists( 'wp_sentry_safe' ) ) {
wp_sentry_safe( function ( \Sentry\State\HubInterface $client ) use ( $e ) {
$client->captureException( $e );
} );
}
return;
}
} else {
$enqueued_handles = $this->load($attributes['slug']);
}
Expand Down
3 changes: 1 addition & 2 deletions includes/interactives/class-interactives.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,10 @@ public function load_legacy_wpackIO($args) {
if ( is_admin() ) {
return;
}

$app_name = array_key_exists( 'appname', $args ) ? $args['appname'] : false;

if ( ! $app_name ) {
return false;
throw new \LogicException( 'No app_name found. Please check that the interactive exists in the file structure.');
}

require_once( plugin_dir_path( __FILE__ ) . 'class-legacy-wpackio-loader.php' );
Expand Down

0 comments on commit 4435fcc

Please sign in to comment.