Update simple-glitchtip.php
This commit is contained in:
parent
170a255d2c
commit
6582359e99
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue