networkteam / sentry_client

TYPO3 Extension for exception logging with sentry, see http://www.getsentry.com
33 stars 35 forks source link

Testing code does not work #93

Closed georgringer closed 6 months ago

georgringer commented 10 months ago

the proposed testing code in readme does not work

page.20 = USER
page.20 {
    userFunc = Networkteam\SentryClient\Client->captureException
}

as it throws an exception:

TypeError
Networkteam\SentryClient\Client::captureException(): Argument #1 ($exception) must be of type Throwable, string given, called in /var/www/html/app/site/vendor/typo3/cms-frontend/Classes/ContentObject/ContentObjectRenderer.php on line 4752

a possible implementation to test could be

    public static function captureTestException(): ?EventId
    {
        $exception = new \Exception('Test exception');
        return captureException($exception);
    }
christophlehmann commented 10 months ago

This TypeError is reported to Sentry.

If that is not the case, did you set the Sentry DSN and configured an ExceptionHandler (Dev context => DebugExceptionHandler, Prod => ProductionExceptionHandler) ?

rorentz commented 10 months ago

I have exactly the same error, and yes, i set the ProductionExceptionHandler as explained.

christophlehmann commented 10 months ago

When you visit the frontend, do you see a stacktrace?

cweiske commented 9 months ago

I did not get the exception reported locally when I only set the production exception handler. Configuring the debugExceptionHandler helped, just as christophlehmann described.