Using Structured Context via $scope->setExtra
-
I’m successfully getting errors logged in Sentry through the plugin, but when trying to use custom Structured Data as per the plugin docs this isn’t coming through with the error. It appears Sentry may have changed their approach to this as their docs use
$scope->setContext
instead of$scope->setExtra
though this method doesn’t work in this plugin.I’d appreciate any pointers on getting this data to flow through to Sentry.
Here’s an example of the code used:
$e = new Exception('Test exception'); if ( function_exists( 'wp_sentry_safe' ) ) { wp_sentry_safe(function (\Sentry\State\HubInterface $client) use ($e) { $client->withScope(function (\Sentry\State\Scope $scope) use ($client, $e) { $scope->setExtra('test_label', 'test_data'); $client->captureException($e); }); }); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using Structured Context via $scope->setExtra’ is closed to new replies.