Skip to content

Commit 29cfbf4

Browse files
committed
fix: bump Appsero\client to v2.0.4
1 parent acae6c7 commit 29cfbf4

File tree

4 files changed

+41
-23
lines changed

4 files changed

+41
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"php": "^7.1 || ^8.0",
2626
"webonyx/graphql-php": "14.11.10",
2727
"ivome/graphql-relay-php": "0.7.0",
28-
"appsero/client": "1.2.1"
28+
"appsero/client": "2.0.4"
2929
},
3030
"require-dev": {
3131
"automattic/vipwpcs": "^3.0",

composer.lock

Lines changed: 20 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ parameters:
3838
excludePaths:
3939
analyseAndScan:
4040
- */node_modules/*
41-
- */vendor/*
4241
ignoreErrors:

wp-graphql.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,28 @@ function graphql_init_appsero_telemetry() {
167167
return;
168168
}
169169

170-
$client = new Appsero\Client( 'cd0d1172-95a0-4460-a36a-2c303807c9ef', 'WPGraphQL', __FILE__ );
171-
$insights = $client->insights();
170+
// Wrap the Appsero client in a try/catch block to prevent fatal errors
171+
try {
172+
$client = new \Appsero\Client( 'cd0d1172-95a0-4460-a36a-2c303807c9ef', 'WPGraphQL', __FILE__ );
172173

173-
// If the Appsero client has the add_plugin_data method, use it
174-
if ( method_exists( $insights, 'add_plugin_data' ) ) {
175-
// @phpstan-ignore-next-line
176-
$insights->add_plugin_data();
177-
}
174+
/** @var \Appsero\Insights $insights */
175+
$insights = $client->insights();
176+
177+
// If the Appsero client has the add_plugin_data method, use it
178+
if ( method_exists( $insights, 'add_plugin_data' ) ) {
179+
$insights->add_plugin_data();
180+
}
178181

179-
// @phpstan-ignore-next-line
180-
$insights->init();
182+
$insights->init();
183+
} catch ( \Throwable $e ) {
184+
error_log( // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Error logging is intentional here.
185+
sprintf(
186+
// translators: %s is the error message
187+
__( 'Error initializing Appsero: %s', 'wp-graphql' ),
188+
$e->getMessage()
189+
)
190+
);
191+
}
181192
}
182193

183194
graphql_init_appsero_telemetry();

0 commit comments

Comments
 (0)