Closed joshuabaker closed 3 years ago
@joshuabaker thanks! Is Sentry::$plugin->sentry->handleException($exception);
a problem with IDE's?
additionally: To be clear, that method is really meant for craft and it's twig errors. You can always do the following:
use Sentry;
try {
// Break your code.
} catch (Exception $e) {
Sentry\captureException($e);
}
It’s mostly able filling in the intellisense and getting rid of the warnings.
https://user-images.githubusercontent.com/160484/104735833-ff206e80-5739-11eb-8fec-9848cfebae79.mov
As it happens, I am using Sentry\captureException($e);
now, so I’m happy with whatever you fancy here.
Perhaps a phpDoc block?
/**
* Class Plugin
*
* @package born05\sentry
* @property-read SentryService $sentry
*/
@joshuabaker if it is good practice i am happy to merge it (I'm using VS Code, so what do i know). Regardless of that, the capture exception you're currently using is the correct way of handling exceptions. ;)
Released in 1.0.11
Allows us to use calls like
Sentry::$plugin->getSentry()->handleException($exception);
without IDEs complaining.