1
0
Fork 1

Update simple-glitchtip.php

This commit is contained in:
colin 2024-07-18 20:27:42 +00:00
parent 170a255d2c
commit 6582359e99
1 changed files with 13 additions and 7 deletions

View File

@ -45,15 +45,21 @@ add_action('admin_init', 'sg_register_settings');
// Initialize error handler
function sg_initialize_error_handler($dsn) {
if (!class_exists('Raven_Client')) {
require_once plugin_dir_path(__FILE__) . 'raven-client.phar';
if (!class_exists('Sentry\State\Hub')) {
require_once plugin_dir_path(__FILE__) . 'sentry.phar';
}
$client = new Raven_Client($dsn);
$error_handler = new Raven_ErrorHandler($client);
$error_handler->registerExceptionHandler();
$error_handler->registerErrorHandler();
$error_handler->registerShutdownFunction();
Sentry\init(['dsn' => $dsn]);
function handle_exception($exception) {
Sentry\captureException($exception);
}
set_exception_handler('handle_exception');
function handle_error($errno, $errstr, $errfile, $errline) {
Sentry\captureMessage("$errstr in $errfile on line $errline");
}
set_error_handler('handle_error');
}
// Initialize the plugin