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 // Initialize error handler
function sg_initialize_error_handler($dsn) { function sg_initialize_error_handler($dsn) {
if (!class_exists('Raven_Client')) { if (!class_exists('Sentry\State\Hub')) {
require_once plugin_dir_path(__FILE__) . 'raven-client.phar'; require_once plugin_dir_path(__FILE__) . 'sentry.phar';
} }
$client = new Raven_Client($dsn); Sentry\init(['dsn' => $dsn]);
$error_handler = new Raven_ErrorHandler($client);
$error_handler->registerExceptionHandler(); function handle_exception($exception) {
$error_handler->registerErrorHandler(); Sentry\captureException($exception);
$error_handler->registerShutdownFunction(); }
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 // Initialize the plugin