diff --git a/src/WpSentry.php b/src/WpSentry.php index f4f720d..a542ac8 100644 --- a/src/WpSentry.php +++ b/src/WpSentry.php @@ -2,6 +2,7 @@ namespace Zeek\WpSentry; +use Sentry; use Sentry\ClientBuilder; use Sentry\Event; use Sentry\SentrySdk; @@ -28,6 +29,10 @@ protected function __construct() { $this->initSentryClient(); } + public function captureException( $exception ) { + Sentry\captureException( $exception ); + } + private function get_dsn() : ?string { $this->sentryDsn = get_env_value( 'SENTRY_DSN' ); @@ -60,7 +65,7 @@ private function get_default_options() : array { ]; $options['before_send'] = function ( Event $event ) : ?Event { - $excludeEvents = array_merge( $this->coreExclusions, get_env_value( 'SENTRY_EXCLUDE_EVENTS' ) ?? []); + $excludeEvents = array_merge( $this->coreExclusions, get_env_value( 'SENTRY_EXCLUDE_EVENTS' ) ?? [] ); // Errors always get reported if ( (string) $event->getLevel() === 'error' ) {