Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author stayallive

    (@stayallive)

    Hey Paul,

    You are looking at the official PHP documentation, that does not fully apply to the WordPress version, you need something like this:

    if ( class_exists( 'WP_Sentry_Php_Tracker' ) ) {
        $sentryClient = WP_Sentry_Php_Tracker::get_instance()->get_client();
    
        $sentryClient->captureException( $e );
    }

    Please do remember that the captureException method only accepts a Exception object.

    Something like the version bellow applies if you want to send a message to Sentry:

    if ( class_exists( 'WP_Sentry_Php_Tracker' ) ) {
        $sentryClient = WP_Sentry_Php_Tracker::get_instance()->get_client();
    
        $sentryClient->captureMessage( 'Some Error!' );
    }

    The $sentryClient in the examples above has the same methods as described in the docs you linked above so that should help you out with figuring out which capture method to use.

    Thread Starter paul.baumgartner

    (@paulbaumgartner)

    Thanks very much, that example worked perfectly for what I want.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Reporting Exceptions’ is closed to new replies.